LibreCAD
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
id.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <atomic>
4 #include "cad/const.h"
5 
6 
7 #define ID_DATATYPE unsigned long
8 
14 namespace lc {
15  class ID {
16  public:
17 
22  ID();
23  ID(ID_DATATYPE);
24 
25  virtual ~ID() = default;
26 
31  ID_DATATYPE id() const ;
32 
33  bool operator == (const ID& id) const {
34  return (id._id == _id);
35  }
36  void setID(ID_DATATYPE id);
37  static std::atomic<ID_DATATYPE> __idCounter;
38  private:
40  };
41 }
ID()
Default constructor, provides a new unique ID to each entity.
Definition: id.cpp:7
bool operator==(const ID &id) const
Definition: id.h:33
#define ID_DATATYPE
Definition: id.h:7
ID_DATATYPE _id
Definition: id.h:39
ID_DATATYPE id() const
returns the ID of the entity
Definition: id.cpp:18
Definition: cadentity.h:12
Definition: id.h:15
virtual ~ID()=default
static std::atomic< ID_DATATYPE > __idCounter
Definition: id.h:37
void setID(ID_DATATYPE id)
Definition: id.cpp:22