20 #include "SheafSystem/poset_handle_factory.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/error_message.h" 24 #include "SheafSystem/namespace_poset.h" 25 #include "SheafSystem/poset.h" 26 #include "SheafSystem/poset_type.h" 27 #include "SheafSystem/primitives_poset.h" 28 #include "SheafSystem/primitives_poset_schema.h" 29 #include "SheafSystem/refinable_poset.h" 50 _sheaf_prototypes_map.reserve(NOT_A_POSET_TYPE);
51 _sheaf_prototypes_map.set_ct(NOT_A_POSET_TYPE);
52 _sheaf_prototypes_map.assign(0);
78 prototypes_map_type::iterator itr = _prototypes_map.begin();
79 while(itr != _prototypes_map.end())
84 _prototypes_map.clear();
91 ensure(unexecutable(
"All prototypes have been deleted."));
113 #ifdef DIAGNOSTIC_OUTPUT 115 cout << SOURCE_CODE_LOCATION
116 <<
" class name= " << xclient_class_name
117 <<
" class id= " << xsheaf_base_class_id
121 prototypes_map_type::iterator itr = _prototypes_map.find(xclient_class_name);
122 if( itr != _prototypes_map.end())
126 result = itr->second->
clone();
132 result = _sheaf_prototypes_map[xsheaf_base_class_id]->clone();
135 #ifdef DIAGNOSTIC_OUTPUT 136 cout <<
"result class: " << result->
class_name() << endl;
161 require(xprototype != 0);
172 _prototypes_map.insert(lval);
192 if(!xclass_name.empty())
194 prototypes_map_type::iterator itr = _prototypes_map.find(xclass_name);
195 if(itr != _prototypes_map.end())
198 _prototypes_map.erase(itr);
229 !xclass_name.empty() &&
230 (_prototypes_map.find(xclass_name) != _prototypes_map.end());
254 result = (_sheaf_prototypes_map[xtype_id] != 0);
276 require(xprototype != 0);
void insert_prototype(const poset_state_handle *xprototype)
Sets xprototype as the prototype for its client class.
virtual ~poset_handle_factory()
Destructor.
poset_type
Identifiers for poset types.
A client handle for a general, abstract partially order set.
poset_state_handle * new_poset_handle(const std::string &xclient_class_name, poset_type xsheaf_base_class_id)
Creates an unattached handle of type xclient_class_name or type xsheaf_base_class_id if no prototype ...
void delete_prototype(const std::string &xclass_name)
Removes the prototype for handles of type xclass_name.
virtual const char * class_name() const
The name of this class.
virtual bool is_attached() const
True if this is attached to a state.
bool contains_prototype(const std::string &xclass_name) const
True if the set of prototypes contains a prototype for handles of type xclass_name.
virtual poset_state_handle * clone() const
Virtual constructor; creates a new handle of the same actual type as this, attached to the same state...
poset_handle_factory()
Default constructor.