// PlacementCategoryType.h #ifndef hes_PlacementCategoryType_H #define hes_PlacementCategoryType_H // David Adams // February 2002 // // A placement category type associates an allowed collection of // EDO typ-keys with a name. #include #include #include "hesbase/Name.h" #include "hesbase/EdoType.h" #include "hesbase/EdoKey.h" #include "hesbase/EdoTypeKey.h" namespace hes { class PlacementCategoryType { public: // typedefs // Collection of types. typedef std::set TypeList; // Collection of type-keys. typedef std::set TypeKeyList; private: // data // Name. Name m_name; // Flag indicating if the object is closed. bool m_closed; // List of allowed type-keys. TypeKeyList m_typekeys; // List of type for which all keys are allowed. TypeList m_types; public: // non-const functions // Constructor. // If nothing is inserted, then all types and keys are allowed. PlacementCategoryType(Name name =Name()); // Add an allowed type-key; void insert(EdoTypeKey tk); void insert(EdoType type, EdoKey key); // Add a type for which all keys are allowed. void insert(EdoType type); // Close this object. // Before this call insertions are allowed. // After this call, nothing may be inserted. // Redundant entries are removed. void close(); public: // const functions // Is this object valid? // The name must be valid. bool is_valid() const; // Return the name. Name name() const; // Has this object been closed? bool is_closed() const; // Is the specified type-key allowed? bool allows(EdoTypeKey tk) const; bool allows(EdoType type, EdoKey key) const; // Return the allowed type-keys. const TypeKeyList& type_keys() const; // Return the types for which all keys are allowed. const TypeList& types() const; }; } // end namespace // Output stream. std::ostream& operator<<(std::ostream& lhs, const hes::PlacementCategoryType& rhs); // Equality. bool operator==(const hes::PlacementCategoryType& lhs, const hes::PlacementCategoryType& rhs); // Inequality. bool operator!=(const hes::PlacementCategoryType& lhs, const hes::PlacementCategoryType& rhs); #endif