MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
hypergraphlib_graphobject.cpp
Aller à la documentation de ce fichier.
1 //####//------------------------------------------------------------
2 //####//------------------------------------------------------------
3 //####// MAGiC
4 //####// Jean Christophe Cuilliere et Vincent FRANCOIS
5 //####// Departement de Genie Mecanique - UQTR
6 //####//------------------------------------------------------------
7 //####// MAGIC est un projet de recherche de l equipe ERICCA
8 //####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres
9 //####// http://www.uqtr.ca/ericca
10 //####// http://www.uqtr.ca/
11 //####//------------------------------------------------------------
12 //####//------------------------------------------------------------
13 //####//
14 //####// hypergraphlib_graphobject.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:54:00 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 #include <map>
23 
24 #pragma hdrstop
25 
26 #include "hypergraphlib_platform.h"
28 namespace HypergraphLib
29 {
30 
31 GraphObject::GraphObject ( const Graph *__owner, const int __id)
32  :
33  _id(__id),
34  _owner(__owner)
35 {
36  for (unsigned i=0; i<100; i++)
37  _userData[i]=0;
38 }
39 
40 GraphObject::GraphObject ( const GraphObject & __from, const Graph * __owner)
41  : _id(__from._id), _owner (__owner)
42 {
43  for (unsigned i=0; i<100; i++)
44  _userData=__from._userData;
45 }
46 
47 int GraphObject::Id () const
48 {
49  return _id;
50 }
51 
52 const Graph * GraphObject::Owner () const
53 {
54  return _owner;
55 }
56 
58 {
59  std::map <int, void*>::const_iterator it = _userData.find(0);
60  if (it != _userData.end())
61  return it->second;
62  else
63  return 0;
64 }
65 
66 void GraphObject::SetUserData(void * __userData)
67 {
68  _userData[0] = __userData;
69 }
70 
71 void * GraphObject::GetUserData(unsigned i) const
72 {
73  std::map <int, void*>::const_iterator it = _userData.find(i);
74  if (it != _userData.end())
75  return it->second;
76  else
77  return 0;
78 }
79 
80 void GraphObject::SetUserData(unsigned i, void * __userData)
81 {
82  _userData[i] = __userData;
83 }
84 
85 } // end namespace HypergraphLib
86 
87 
HypergraphLib::GraphObject::_userData
std::map< int, void * > _userData
Definition: hypergraphlib_graphobject.h:44
HypergraphLib::GraphObject::GetUserData
void * GetUserData() const
Definition: hypergraphlib_graphobject.cpp:57
hypergraphlib_graphobject.h
HypergraphLib
Definition: hypergraphlib_arc.cpp:32
HypergraphLib::GraphObject::_owner
const Graph * _owner
Definition: hypergraphlib_graphobject.h:42
HypergraphLib::GraphObject
Definition: hypergraphlib_graphobject.h:31
HypergraphLib::GraphObject::Id
int Id() const
Definition: hypergraphlib_graphobject.cpp:47
hypergraphlib_platform.h
HypergraphLib::GraphObject::_id
const int _id
Definition: hypergraphlib_graphobject.h:43
HypergraphLib::GraphObject::Owner
const Graph * Owner() const
Definition: hypergraphlib_graphobject.cpp:52
HypergraphLib::GraphObject::GraphObject
GraphObject(const Graph *__owner, const int __id)
Definition: hypergraphlib_graphobject.cpp:31
HypergraphLib::GraphObject::SetUserData
void SetUserData(void *)
Definition: hypergraphlib_graphobject.cpp:66