idgraph.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. //
  12. // ========= idgraph.h: AcDbObjectIdGraph classes ================
  13. //
  14. // This header defines classes:
  15. //
  16. // AcDbObjectIdGraph - a derived class for representing object references
  17. // AcDbObjectIdGraphNode - each node represents an object id
  18. //
  19. //
  20. #ifndef AD_IDGRAPH_H
  21. #define AD_IDGRAPH_H 1
  22. #include "graph.h"
  23. #include "dbidmap.h"
  24. #pragma pack (push, 8)
  25. // =====================================
  26. // Object Id Graph Classes
  27. // =====================================
  28. class AcDbObjectIdGraphNode : public AcDbGraphNode
  29. {
  30. public:
  31. AcDbObjectIdGraphNode(const AcDbObjectId id);
  32. virtual ~AcDbObjectIdGraphNode();
  33. AcDbObjectId id () const;
  34. private:
  35. AcDbObjectId mId;
  36. };
  37. class AcDbObjectIdGraph : public AcDbGraph
  38. {
  39. public:
  40. AcDbObjectIdGraph();
  41. virtual ~AcDbObjectIdGraph();
  42. Acad::ErrorStatus addNode (AcDbObjectIdGraphNode *);
  43. Acad::ErrorStatus delNode (AcDbObjectIdGraphNode *);
  44. AcDbObjectIdGraphNode* findNode (const AcDbObjectId) const;
  45. AcDbObjectIdGraphNode* idNode (int idx) const;
  46. private:
  47. AcDbIdMapping mIdNodeMap;
  48. };
  49. // =====================================
  50. // Inline methods
  51. // =====================================
  52. // AcDbObjectIdGraphNode inlines
  53. inline AcDbObjectId AcDbObjectIdGraphNode::id() const
  54. {return mId; }
  55. // AcDbObjectId inlines ...
  56. inline AcDbObjectIdGraphNode* AcDbObjectIdGraph::idNode(int idx) const
  57. { return (AcDbObjectIdGraphNode*)node(idx); }
  58. #pragma pack (pop)
  59. #endif