PaCO++  0.05
Identity Class Reference

#include <Identity.h>

Inheritance diagram for Identity:
Inheritance graph
Collaboration diagram for Identity:
Collaboration graph

Public Member Functions

virtual void clientFree ()
 
virtual PieceToSendcomputePiecesToSend (unsigned &size)
 
virtual bool freeComId (long id)
 
virtual void * getClientData (void *pid, int server_node, long &size, long &length, bool &end)
 
virtual void * getDescr ()
 
virtual PaCO::PacoTopology_t getDestTopology ()
 
virtual long getNodeRank ()
 
virtual void * getServerData (long &length)
 
virtual PaCO::PacoTopology_t getSourceTopology ()
 
 Identity ()
 
virtual bool insertData (void *rcptBuf, unsigned long element_nb)
 
virtual void serverFree ()
 
virtual bool setComId (long id)
 
virtual void setCommunicator (void *group)
 
virtual void setDataPtr (void *dataPtr)
 
virtual void setDescr (void *descr)
 
virtual void setDestTopology (PaCO::PacoTopology_t topo)
 
void setEltSize (unsigned long size)
 
void setLocalNbElt (unsigned long elt_nb)
 
virtual void setNodeRank (long Rank)
 
virtual void setSourceTopology (PaCO::PacoTopology_t topo)
 
virtual ~Identity ()
 

Private Attributes

char * _clientBuffer
 
IdentityLib::IdentityDescr _clientDescr
 
unsigned _config
 
PaCO::PacoTopology_t _dTopo
 
unsigned _llen
 
unsigned _nodeRank
 
char * _serverBuffer
 
IdentityLib::IdentityDescr_serverDescr
 
unsigned long _serverToReceived
 
PaCO::PacoTopology_t _sTopo
 
unsigned _unitsize
 

Detailed Description

Definition at line 13 of file Identity.h.

Constructor & Destructor Documentation

◆ Identity()

Identity::Identity ( )

Definition at line 18 of file Identity.cc.

References _clientBuffer, _config, _dTopo, _nodeRank, _serverBuffer, _serverDescr, _sTopo, and PaCO::PacoTopology_s::total.

19 {
20  // Common
21  _config = 0;
22 
23  // By default 1->1 :)
24  _sTopo.total=1;
25  _dTopo.total=1;
26  _nodeRank=0;
27 
28  // Client side
29  _clientBuffer=NULL;
30 
31  // Server side
32  _serverDescr=NULL;
33  _serverBuffer=NULL;
34 }
IdentityLib::IdentityDescr * _serverDescr
Definition: Identity.h:38
PaCO::PacoTopology_t _dTopo
Definition: Identity.h:22
char * _serverBuffer
Definition: Identity.h:36
PaCO::PacoTopology_t _sTopo
Definition: Identity.h:21
char * _clientBuffer
Definition: Identity.h:30
unsigned _config
Definition: Identity.h:19
unsigned long total
Definition: PaCO++.idl:35
unsigned _nodeRank
Definition: Identity.h:24

◆ ~Identity()

Identity::~Identity ( )
virtual

Definition at line 36 of file Identity.cc.

37 {
38 }

Member Function Documentation

◆ clientFree()

void Identity::clientFree ( )
virtual

Implements DistributionLibrary.

Definition at line 174 of file Identity.cc.

175 {
176 
177 #ifdef DEBUG_INTERNAL
178  std::cerr << "-- clientFree\n";
179 #endif
180 }

◆ computePiecesToSend()

PieceToSend * Identity::computePiecesToSend ( unsigned &  size)
virtual

Implements DistributionLibrary.

Definition at line 114 of file Identity.cc.

References _config, _llen, _nodeRank, CORRECT_CONFIG, PieceToSend::destNode, PieceToSend::id, PieceToSend::size, and PieceToSend::sourceNode.

115 {
116 
117  PieceToSend * sched;
118 
119 #ifdef DEBUG_INTERNAL
120  std::cerr << "computePiecesToSend-------------------- in\n";
121  std::cerr << __FUNCTION__ << ": config = "<<_config<<endl;
122 #endif
123 
124  if (_config != CORRECT_CONFIG) {
125  std::cerr << "Identity: incorrect configuration state "<< _config<<"/"<<CORRECT_CONFIG<<endl;
126  abort();
127  }
128 
129  sched = new PieceToSend[1];
130  size_out = 1;
131 
132  sched[0].sourceNode = _nodeRank; // my self :)
133  sched[0].destNode = _nodeRank; // the corresponding node
134  sched[0].size = _llen; // msg size
135  sched[0].id = (void*) -1; /* not used */
136 
137 
138 #ifdef DEBUG_INTERNAL
139  std::cerr << "computePiecesToSend-------------------- done\n";
140 #endif
141 
142  return sched;
143 }
#define CORRECT_CONFIG
Definition: Identity.cc:9
unsigned _config
Definition: Identity.h:19
unsigned _llen
Definition: Identity.h:25
unsigned _nodeRank
Definition: Identity.h:24

◆ freeComId()

virtual bool DistributionLibrary::freeComId ( long  id)
inlinevirtualinherited

Reimplemented in BasicBC, and GaBro.

Definition at line 41 of file DistributionLibrairie.h.

41 { return false;}

◆ getClientData()

void * Identity::getClientData ( void *  pid,
int  server_node,
long &  size,
long &  length,
bool &  end 
)
virtual

Implements DistributionLibrary.

Definition at line 155 of file Identity.cc.

References _clientBuffer, and _llen.

156 {
157  if (remaining_size_octet < _llen) {
158  std::cerr << "Identity: not yet implemented !\n";
159  abort();
160  }
161 
162 #ifdef DEBUG_INTERNAL
163  std::cerr << __FUNCTION__ << ": getClientData returns #elt: "<<_llen<<endl;
164 #endif
165 
166  remaining_size_octet-= _llen;
167  returned_length_element= _llen;
168  end=true;
169 
170  return _clientBuffer;
171 }
char * _clientBuffer
Definition: Identity.h:30
unsigned _llen
Definition: Identity.h:25

◆ getDescr()

void * Identity::getDescr ( )
virtual

Implements DistributionLibrary.

Definition at line 183 of file Identity.cc.

References _clientDescr, and IdentityLib::IdentityDescr::llen.

184 {
185 #ifdef DEBUG_INTERNAL
186  std::cerr << "-- descr:llen: "<<_clientDescr.llen<<std::endl;
187 #endif
188  return &_clientDescr;
189 }
IdentityLib::IdentityDescr _clientDescr
Definition: Identity.h:31

◆ getDestTopology()

PaCO::PacoTopology_t Identity::getDestTopology ( )
virtual

Implements DistributionLibrary.

Definition at line 70 of file Identity.cc.

References _dTopo.

71 {
72  std::cerr << "****** Why is the method " << __FUNCTION__ << "called?\n";
73  abort();
74  return _dTopo;
75 }
PaCO::PacoTopology_t _dTopo
Definition: Identity.h:22

◆ getNodeRank()

long Identity::getNodeRank ( )
virtual

Implements DistributionLibrary.

Definition at line 87 of file Identity.cc.

References _nodeRank.

88 {
89  return _nodeRank;
90 }
unsigned _nodeRank
Definition: Identity.h:24

◆ getServerData()

void * Identity::getServerData ( long &  length)
virtual

Implements DistributionLibrary.

Definition at line 211 of file Identity.cc.

References _llen, and _serverBuffer.

212 {
213  length= _llen;
214 #ifdef DEBUG_INTERNAL
215  std::cerr << "-- getServerData: ptr : "<<(void*)_serverBuffer<<" #element:"<<length<<std::endl;
216 #endif
217  return (void*) _serverBuffer;
218 }
char * _serverBuffer
Definition: Identity.h:36
unsigned _llen
Definition: Identity.h:25

◆ getSourceTopology()

PaCO::PacoTopology_t Identity::getSourceTopology ( )
virtual

Implements DistributionLibrary.

Definition at line 51 of file Identity.cc.

References _sTopo.

52 {
53  std::cerr << "****** Why is the method " << __FUNCTION__ << "called?\n";
54  abort();
55  return _sTopo;
56 }
PaCO::PacoTopology_t _sTopo
Definition: Identity.h:21

◆ insertData()

bool Identity::insertData ( void *  rcptBuf,
unsigned long  element_nb 
)
virtual

Implements DistributionLibrary.

Definition at line 192 of file Identity.cc.

References _llen, _serverBuffer, and _unitsize.

193 {
194  // cp from recpBuf to _serverBuffer
195 #ifdef DEBUG_INTERNAL
196  std::cerr << "-- insertData "<<endl;
197 #endif
198 
199  if (element_nb != _llen) {
200  std::cerr << "Identity: not yet implemented !\n";
201  abort();
202  }
203 
204  unsigned long llen = element_nb*_unitsize;
205  memcpy(_serverBuffer, rcptBuf, llen);
206 
207  return true;
208 }
char * _serverBuffer
Definition: Identity.h:36
unsigned _unitsize
Definition: Identity.h:26
unsigned _llen
Definition: Identity.h:25

◆ serverFree()

void Identity::serverFree ( )
virtual

Implements DistributionLibrary.

Definition at line 249 of file Identity.cc.

References _serverBuffer.

250 {
251 #ifdef DEBUG_INTERNAL
252  std::cerr << "-- serverFree: "<<(void*)_serverBuffer<<endl;
253 #endif
254  free(_serverBuffer);
255  _serverBuffer=NULL; // the orb (or the user) need to free the memory!
256 }
char * _serverBuffer
Definition: Identity.h:36

◆ setComId()

virtual bool DistributionLibrary::setComId ( long  id)
inlinevirtualinherited

Reimplemented in BasicBC, and GaBro.

Definition at line 40 of file DistributionLibrairie.h.

Referenced by PaCO_operation::useCommunicationMemoryId().

40 { return false;}

◆ setCommunicator()

virtual void Identity::setCommunicator ( void *  group)
inlinevirtual

Implements DistributionLibrary.

Definition at line 54 of file Identity.h.

54 {}

◆ setDataPtr()

void Identity::setDataPtr ( void *  dataPtr)
virtual

Implements DistributionLibrary.

Definition at line 146 of file Identity.cc.

References _clientBuffer.

147 {
148  _clientBuffer = (char *) dataPtr;
149 #ifdef DEBUG_INTERNAL
150  cerr << "-- _clientBuffer set to "<<dataPtr<<endl;
151 #endif
152 }
char * _clientBuffer
Definition: Identity.h:30

◆ setDescr()

void Identity::setDescr ( void *  descr)
virtual

Implements DistributionLibrary.

Definition at line 221 of file Identity.cc.

References _dTopo, _llen, _serverBuffer, _serverDescr, _serverToReceived, _sTopo, _unitsize, IdentityLib::IdentityDescr::llen, setLocalNbElt(), and PaCO::PacoTopology_s::total.

222 {
223  std::cerr << "-- insertData "<<endl;
224 
226 
227  // Descr already received
228 
229  if ( _serverBuffer == NULL)
230  {
231  // 1st time -> allocate memory & init
232  //this->setEltSize(_descr->usz); BUG: usz can be different in client and server (32bit vs 64bit)
233  unsigned long len = _serverDescr->llen*_unitsize;
235 
236 #ifdef DEBUG_INTERNAL
237  fprintf(stderr, "-- setDescr: stopo: %ld\tdtopo: %ld\n",_sTopo.total, _dTopo.total);
238  fprintf(stderr, " setDescr: local len: %ld", _serverDescr->llen);
239 #endif
240  _serverBuffer = (char*) malloc(len);
241 #ifdef DEBUG_INTERNAL
242  std::cerr << "-- serverMalloc: "<<(void*)_serverBuffer<<" - "<<_llen<<endl;
243 #endif
244  _serverToReceived = len;
245  }
246 }
IdentityLib::IdentityDescr * _serverDescr
Definition: Identity.h:38
PaCO::PacoTopology_t _dTopo
Definition: Identity.h:22
char * _serverBuffer
Definition: Identity.h:36
PaCO::PacoTopology_t _sTopo
Definition: Identity.h:21
unsigned long total
Definition: PaCO++.idl:35
unsigned _unitsize
Definition: Identity.h:26
unsigned _llen
Definition: Identity.h:25
void setLocalNbElt(unsigned long elt_nb)
Definition: Identity.cc:103
unsigned long _serverToReceived
Definition: Identity.h:35
Here is the call graph for this function:

◆ setDestTopology()

void Identity::setDestTopology ( PaCO::PacoTopology_t  topo)
virtual

Implements DistributionLibrary.

Definition at line 59 of file Identity.cc.

References _config, _dTopo, DST_TOPOLOGY, and PaCO::PacoTopology_s::total.

60 {
61 #ifdef DEBUG_INTERNAL
62  std::cerr << "-- setDestTopology: " << topo.total << std::endl;
63 #endif
65  _dTopo = topo;
66 
67 }
PaCO::PacoTopology_t _dTopo
Definition: Identity.h:22
unsigned _config
Definition: Identity.h:19
unsigned long total
Definition: PaCO++.idl:35
#define DST_TOPOLOGY
Definition: Identity.cc:5

◆ setEltSize()

void Identity::setEltSize ( unsigned long  size)

Definition at line 93 of file Identity.cc.

References _config, _unitsize, and ELEMENT_SIZE.

94 {
95 #ifdef DEBUG_INTERNAL
96  std::cerr << "-- setEltSize: " << size << std::endl;
97 #endif
99  _unitsize = size;
100 }
unsigned _config
Definition: Identity.h:19
unsigned _unitsize
Definition: Identity.h:26
#define ELEMENT_SIZE
Definition: Identity.cc:6

◆ setLocalNbElt()

void Identity::setLocalNbElt ( unsigned long  elt_nb)

Definition at line 103 of file Identity.cc.

References _clientDescr, _config, _llen, IdentityLib::IdentityDescr::llen, and LOCAL_SIZE.

Referenced by setDescr().

104 {
105 #ifdef DEBUG_INTERNAL
106  std::cerr << "-- setLocalNbElt: " << elt_nb << std::endl;
107 #endif
108  _config |= LOCAL_SIZE;
109  _clientDescr.llen = _llen = elt_nb;
110 }
unsigned _config
Definition: Identity.h:19
#define LOCAL_SIZE
Definition: Identity.cc:7
IdentityLib::IdentityDescr _clientDescr
Definition: Identity.h:31
unsigned _llen
Definition: Identity.h:25

◆ setNodeRank()

void Identity::setNodeRank ( long  Rank)
virtual

Implements DistributionLibrary.

Definition at line 78 of file Identity.cc.

References _nodeRank.

79 {
80 #ifdef DEBUG_INTERNAL
81  std::cerr << "-- setNodeRank: " << Rank << std::endl;
82 #endif
83  _nodeRank = Rank;
84 }
unsigned _nodeRank
Definition: Identity.h:24

◆ setSourceTopology()

void Identity::setSourceTopology ( PaCO::PacoTopology_t  topo)
virtual

Implements DistributionLibrary.

Definition at line 41 of file Identity.cc.

References _config, _sTopo, SRC_TOPOLOGY, and PaCO::PacoTopology_s::total.

42 {
43 #ifdef DEBUG_INTERNAL
44  std::cerr << "-- setSourceTopology: " << topo.total << std::endl;
45 #endif
47  _sTopo = topo;
48 }
#define SRC_TOPOLOGY
Definition: Identity.cc:4
PaCO::PacoTopology_t _sTopo
Definition: Identity.h:21
unsigned _config
Definition: Identity.h:19
unsigned long total
Definition: PaCO++.idl:35

Member Data Documentation

◆ _clientBuffer

char* Identity::_clientBuffer
private

Definition at line 30 of file Identity.h.

Referenced by getClientData(), Identity(), and setDataPtr().

◆ _clientDescr

IdentityLib::IdentityDescr Identity::_clientDescr
private

Definition at line 31 of file Identity.h.

Referenced by getDescr(), and setLocalNbElt().

◆ _config

unsigned Identity::_config
private

◆ _dTopo

PaCO::PacoTopology_t Identity::_dTopo
private

Definition at line 22 of file Identity.h.

Referenced by getDestTopology(), Identity(), setDescr(), and setDestTopology().

◆ _llen

unsigned Identity::_llen
private

◆ _nodeRank

unsigned Identity::_nodeRank
private

Definition at line 24 of file Identity.h.

Referenced by computePiecesToSend(), getNodeRank(), Identity(), and setNodeRank().

◆ _serverBuffer

char* Identity::_serverBuffer
private

Definition at line 36 of file Identity.h.

Referenced by getServerData(), Identity(), insertData(), serverFree(), and setDescr().

◆ _serverDescr

IdentityLib::IdentityDescr* Identity::_serverDescr
private

Definition at line 38 of file Identity.h.

Referenced by Identity(), and setDescr().

◆ _serverToReceived

unsigned long Identity::_serverToReceived
private

Definition at line 35 of file Identity.h.

Referenced by setDescr().

◆ _sTopo

PaCO::PacoTopology_t Identity::_sTopo
private

Definition at line 21 of file Identity.h.

Referenced by getSourceTopology(), Identity(), setDescr(), and setSourceTopology().

◆ _unitsize

unsigned Identity::_unitsize
private

Definition at line 26 of file Identity.h.

Referenced by insertData(), setDescr(), and setEltSize().


The documentation for this class was generated from the following files: