1 |
francois |
1156 |
//####//------------------------------------------------------------ |
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 |
francois |
283 |
#include <map> |
23 |
|
|
|
24 |
|
|
#pragma hdrstop |
25 |
|
|
|
26 |
francois |
481 |
#include "hypergraphlib_platform.h" |
27 |
|
|
#include "hypergraphlib_graphobject.h" |
28 |
francois |
283 |
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 |
|
|
|
57 |
|
|
void * GraphObject::GetUserData() const |
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 |
foucault |
176 |
} // end namespace HypergraphLib |
86 |
|
|
|
87 |
francois |
283 |
|