21 #include "SheafSystem/primitive_attributes.h" 23 #include "SheafSystem/assert_contract.h" 24 #include "SheafSystem/block.impl.h" 25 #include "SheafSystem/namespace_relative_member_index.h" 26 #include "SheafSystem/namespace_relative_subposet_index.h" 27 #include "SheafSystem/primitive_traits.h" 28 #include "SheafSystem/std_map.h" 29 #include "SheafSystem/std_sstream.h" 31 using namespace sheaf;
39 typedef map<string, sheaf::primitive_type> map_type;
44 map_type& make_name_to_id_map()
51 static map_type result;
58 result[lprim.
name()] = i;
59 stringstream lstrm(lprim.
aliases());
61 while(lstrm >> lalias)
69 #ifdef DIAGNOSTIC_OUTPUT 70 cout <<
"name to id map: " << endl;
71 for(map_type::const_iterator litr = result.begin(); litr != result.end(); ++litr)
73 cout << litr->first <<
" " << litr->second << endl;
79 ensure(!result.empty());
109 ensure(static_cast<pod_index_type>(result.
id()) ==
120 id(
const std::string& xtype_name)
124 require(!xtype_name.empty());
128 static const map_type& lmap = make_name_to_id_map();
132 map_type::const_iterator litr = lmap.find(xtype_name);
133 if(litr != lmap.end())
135 result = litr->second;
181 (*this) = prototype(xid);
243 template <
typename T>
281 (*this) = prototype(C_STRING);
301 (*this) = prototype(POD_INDEX_TYPE);
321 (*this) = prototype(NAMESPACE_RELATIVE_MEMBER_INDEX);
341 (*this) = prototype(NAMESPACE_RELATIVE_SUBPOSET_INDEX);
355 #ifndef DOXYGEN_SKIP_PRIMITIVE_INSTANTIATIONS 377 #endif // ifndef DOXYGEN_SKIP_PRIMITIVE_INSTANTIATIONS 379 #ifndef DOXYGEN_SHOULD_SKIP_THIS 386 #endif // DOXYGEN_SHOULD_SKIP_THIS 402 _alignment = x._alignment;
404 _aliases = x._aliases;
405 _hdf_type_name = x._hdf_type_name;
406 _hdf_type = x._hdf_type;
425 sheaf::primitive_attributes::
431 result.alignment = _alignment;
443 sheaf::primitive_attributes::
482 result.
set_ct(PRIMITIVE_TYPE_END+1);
Index for identifying a poset member relative to a given name space.
primitive_attributes()
Default constructor.
static size_type size()
The size of T in bytes.
size_type ct() const
The number of items currently in use.
primitive_attributes & operator=(const primitive_attributes &)
Copy assignment operator.
static std::string name()
The name of T.
static std::string hdf_type_name()
The name of T in the hdf file.
static int hdf_type()
The hdf type used to represent T in the hdf file.
primitive_type
Type ids for sheaf primitives.
static const std::string & aliases(pod_index_type xid)
Other names for the primitive type with id xid.
void set_ct(size_type xct)
Sets ct() == xct.
An index within the external ("client") scope of a given id space.
static primitive_type id(const std::string &xname)
Type id of the primitive type with name or alias xname.
POD type associated with namespace_relative_subposet_index.
POD type for namespace_relative_member_index.
Abstract object wrapper for an instance of a primitive type.
SHEAF_DLL_SPEC bool is_primitive_index(pod_index_type xindex)
True if xindex is a valid primitive index.
~primitive_attributes()
Destructor; not virtual, this can not be a base class.
Traits for primitive type T.
Index for identifying a subposet relative to a given name space.
static primitive_type id()
The primitive type id for T.
static std::string aliases()
Other names for T.
static const primitive_attributes & prototype(pod_index_type xid)
The prototype for the primitive value of the type associated with xid.
static const std::string & name(pod_index_type xid)
The name of primitive type with id xid.
static size_type alignment()
The alignment for T in bytes.
int_type pod_index_type
The plain old data index type.
primitive_type id() const
The id for the primitive type associated with this.
Namespace for the sheaves component of the sheaf system.
An auto_block with a no-initialization initialization policy.