xc
Public Member Functions | Protected Member Functions | List of all members
XC::UDP_Socket Class Reference

DP_Socket is a sub-class of channel. More...

#include <UDP_Socket.h>

Inheritance diagram for XC::UDP_Socket:
Inheritance graph
[legend]
Collaboration diagram for XC::UDP_Socket:
Collaboration graph
[legend]

Public Member Functions

 UDP_Socket (bool checkEndianness=false)
 
 UDP_Socket (unsigned int port, bool checkEndianness=false)
 
 UDP_Socket (unsigned int other_Port, char *other_InetAddr, bool checkEndianness=false)
 UDP_Socket(unsigned int other_Port, char *other_InetAddr): constructor to open a socket with my inet_addr and with a port number given by the OS. More...
 
std::string addToProgram (void)
 When creating remote actors the channels created in the actor space need to know how to contact the shadows channels. More...
 
virtual int setUpConnection (void)
 
int setNextAddress (const ChannelAddress &otherChannelAddress)
 A method invoked to set specify the next address that the next messages to be sent if {sendMessage()} or received if {recvMessage()} is invoked with a null pointer. More...
 
int sendObj (int commitTag, MovableObject &, ChannelAddress *theAddress=0)
 Send the object a través de éste canal.
 
int recvObj (int commitTag, MovableObject &, FEM_ObjectBroker &, ChannelAddress *theAddress=0)
 Receive the object a través de éste canal.
 
int sendMsg (int dbTag, int commitTag, const Message &, ChannelAddress *theAddress=0)
 A method invoked to send the data in the Message object theMsg to another Channel object. More...
 
int recvMsg (int dbTag, int commitTag, Message &, ChannelAddress *theAddress=0)
 Invoked to send the data in the Message object theMsg to another Channel object. More...
 
int sendMatrix (int dbTag, int commitTag, const Matrix &, ChannelAddress *theAddress=0)
 Invoked to receive the data in the Matrix object theMatrix to another Channel object. More...
 
int recvMatrix (int dbTag, int commitTag, Matrix &, ChannelAddress *theAddress=0)
 Invoked to receive the data in the Matrix object theMatrix to another Channel object. More...
 
int sendVector (int dbTag, int commitTag, const Vector &, ChannelAddress *theAddress=0)
 Invoked to receive the data in the Vector object theVector to another Channel object. More...
 
int recvVector (int dbTag, int commitTag, Vector &, ChannelAddress *theAddress=0)
 Invoked to receive the data in the Vector object theVector to another Channel object. More...
 
int sendID (int dbTag, int commitTag, const ID &, ChannelAddress *theAddress=0)
 Invoked to receive the data in the ID object theID to another Channel object. More...
 
int recvID (int dbTag, int commitTag, ID &, ChannelAddress *theAddress=0)
 Invoked to receive the data in the ID object theID to another Channel object. More...
 
- Public Member Functions inherited from XC::TCP_UDP_Socket_base
 TCP_UDP_Socket_base (int connectType=0, bool checkEndianness=false)
 Constructor to open a socket with my inet_addr and with a port number port. More...
 
- Public Member Functions inherited from XC::Channel
 Channel (CommandEntity *owr=nullptr)
 Constructor.
 
virtual ChannelAddressgetLastSendersAddress (void)=0
 
virtual bool isDatastore (void) const
 Return true if channel is a data store.
 
virtual int getDbTag (void) const
 Return next available database tag. More...
 
bool checkDbTag (const int &dbTag)
 Check if a dbTag is already used.
 
const IDgetUsedTags (void) const
 Return the list of dbTags already used.
 
void clearDbTags (void)
 Reset used database tags set.
 
int getTag (void) const
 Return the object tag.
 
template<class inputIterator >
int sendObjs (int commitTag, const inputIterator &first, const inputIterator &last, ChannelAddress *theAddress=nullptr)
 Send the objects on interval [first,last).
 
template<class inputIterator >
int recvObjs (int commitTag, const inputIterator &first, const inputIterator &last, FEM_ObjectBroker &, ChannelAddress *theAddress=nullptr)
 Receive an object sequence.
 
- Public Member Functions inherited from CommandEntity
 CommandEntity (CommandEntity *owr=nullptr)
 Default constructor.
 
CommandEntityOwner (void)
 Return a pointer to the object owner.
 
const CommandEntityOwner (void) const
 Return un puntero al objeto propietario de ESTE.
 
const StandardOutputWrappergetStandardOutputWrapper (void) const
 Return the regular output stream wrapper.
 
StandardOutputWrappergetStandardOutputWrapper (void)
 Return the regular output stream wrapper.
 
const std::string & getLogFileName (void) const
 Returns log file name.
 
void setLogFileName (const std::string &)
 Sets log file name.
 
const std::string & getErrFileName (void) const
 Returns err file name.
 
void setErrFileName (const std::string &)
 Sets error file name.
 
const std::string & getOutputFileName (void) const
 Returns regular output file name.
 
void setOutputFileName (const std::string &)
 Sets regular output file name.
 
boost::python::object evalPy (boost::python::object dict, const std::string &)
 Return the Python object that results from evaluating the argument.
 
boost::python::object execPy (boost::python::object dict, const std::string &)
 Return the Python objects that results from executing the code in the string argument.
 
boost::python::object execFilePy (boost::python::object dict, const std::string &)
 Return the Python object that results from executing the code in the file.
 
- Public Member Functions inherited from EntityWithProperties
 EntityWithProperties (EntityWithProperties *owr=nullptr)
 Default constructor.
 
virtual bool operator== (const EntityWithProperties &) const
 Comparison operator.
 
void clearPyProps (void)
 Clear python properties map.
 
bool hasPyProp (const std::string &)
 Returns true if property exists.
 
boost::python::object getPyProp (const std::string &str)
 Return the Python object with the name being passed as parameter.
 
void setPyProp (std::string str, boost::python::object val)
 Sets/appends a value tho the Python object's dictionary.
 
void copyPropsFrom (const EntityWithProperties &)
 Copy the properties from the argument.
 
boost::python::list getPropNames (void) const
 Return the names of the object properties weightings.
 
const PythonDict & getPropertiesDict (void) const
 Return a std::map container with the properties of the object.
 
boost::python::dict getPyDict (void) const
 Return a Python dictionary containing the object members values.
 
void setPyDict (const boost::python::dict &)
 Set the values of the object members from a Python dictionary.
 
- Public Member Functions inherited from EntityWithOwner
 EntityWithOwner (EntityWithOwner *owr=nullptr)
 Default constructor.
 
 EntityWithOwner (const EntityWithOwner &)
 Copy constructor.
 
EntityWithOwneroperator= (const EntityWithOwner &)
 Assignment operator.
 
virtual bool operator== (const EntityWithOwner &) const
 Comparison operator.
 
virtual ~EntityWithOwner (void)
 Virtual destructor.
 
virtual std::string getClassName (void) const
 Returns demangled class name.
 
void set_owner (EntityWithOwner *owr)
 Assigns the owner of the object.
 
EntityWithOwnerOwner (void)
 
const EntityWithOwnerOwner (void) const
 

Protected Member Functions

virtual void checkForEndiannessProblem (void)
 
- Protected Member Functions inherited from XC::TCP_UDP_Socket_base
unsigned int getPortNumber (void) const
 
std::string getHostName (void) const
 
void setup (unsigned int, int)
 
- Protected Member Functions inherited from XC::Channel
int sendMovable (int commitTag, MovableObject &)
 Send theObject.
 
int receiveMovable (int commitTag, MovableObject &, FEM_ObjectBroker &)
 Receive theObject.
 
- Protected Member Functions inherited from CommandEntity
template<class T >
void string_to (T &, const std::string &) const
 

Additional Inherited Members

- Public Types inherited from EntityWithProperties
typedef std::map< std::string, boost::python::object > PythonDict
 
- Static Public Member Functions inherited from CommandEntity
static void resetStandardOutput (void)
 Reset the standard output streams to its defaults buffers.
 
- Static Public Member Functions inherited from EntityWithOwner
static int getVerbosityLevel (void)
 Get the value of the verbosity level.
 
static void setVerbosityLevel (const int &)
 Set the value of the verbosity level.
 
- Static Protected Member Functions inherited from XC::TCP_UDP_Socket_base
static int getHostAddress (const std::string &, char *)
 Is a static method to get the internet address of a host Takes machine name host & Returns 0 if o.k, -1 if gethostbyname error, -2 otherwise. More...
 
static void int2a (unsigned int, char *, int *)
 Static method to convert int to ascii.
 
- Static Protected Member Functions inherited from CommandEntity
static CommandEntityentcmd_cast (boost::any &data)
 
- Protected Attributes inherited from XC::TCP_UDP_Socket_base
socket_type sockfd
 
int connectType
 
union {
   struct sockaddr   addr
 
   struct sockaddr_in   addr_in
 
my_Addr
 
union {
   struct sockaddr   addr
 
   struct sockaddr_in   addr_in
 
other_Addr
 
socklen_type addrLength
 
unsigned int myPort
 
bool checkEndianness
 
bool endiannessProblem
 
- Static Protected Attributes inherited from EntityWithOwner
static int verbosity = 1
 Object that owns THIS ONE. More...
 

Detailed Description

DP_Socket is a sub-class of channel.

It is implemented with Berkeley datagram sockets using the UDP protocol. Messages delivery is thus unreliable.

Constructor & Destructor Documentation

◆ UDP_Socket()

XC::UDP_Socket::UDP_Socket ( unsigned int  other_Port,
char *  other_InetAddr,
bool  checkendianness = false 
)

UDP_Socket(unsigned int other_Port, char *other_InetAddr): constructor to open a socket with my inet_addr and with a port number given by the OS.

It then sends a message comprising of a single character to an address given by other_InetAddr and other_Port. This is to allow a shadow object to find address of the actor it initiates.

Member Function Documentation

◆ addToProgram()

std::string XC::UDP_Socket::addToProgram ( void  )
virtual

When creating remote actors the channels created in the actor space need to know how to contact the shadows channels.

This information is provided in the string returned from this method. It is used by the machine broker when starting the remote process. It places this information as the last arguments to the program.

Implements XC::Channel.

◆ recvID()

int XC::UDP_Socket::recvID ( int  dbTag,
int  commitTag,
ID theID,
ChannelAddress theAddress = 0 
)
virtual

Invoked to receive the data in the ID object theID to another Channel object.

The object will obtain the data and size of the data to be sent by invoking getData() and getSize() on theID. The channel object is then responsible for sending that data to the remote channel address given by theAddress. If theAddress is 0, the Channel sends to the Channel with the address last set in a send..()}, recv..(), or setNextAddress() operation. To return 0 if successful, a negative number if not.

Implements XC::Channel.

◆ recvMatrix()

int XC::UDP_Socket::recvMatrix ( int  dbTag,
int  commitTag,
Matrix theMatrix,
ChannelAddress theAddress = 0 
)
virtual

Invoked to receive the data in the Matrix object theMatrix to another Channel object.

The object will obtain the data and size of the data to be sent by invoking getData() and getSize() on theMatrix. The channel object is then responsible for sending that data to the remote channel address given by theAddress. If theAddress is 0, the Channel sends to the Channel with the address last set in a send..()}, recv..(), or setNextAddress() operation. To return 0 if successful, a negative number if not.

Implements XC::Channel.

◆ recvMsg()

int XC::UDP_Socket::recvMsg ( int  dbTag,
int  commitTag,
Message theMsg,
ChannelAddress theAddress = 0 
)
virtual

Invoked to send the data in the Message object theMsg to another Channel object.

The object will obtain the the size of the data that is being received by invoking getSize() on theMsg. The channel object is then responsible for receiving that amount of data from the channel whose address is given by theAddress. If theAddress is 0, the Channel receives from the Channel with the address last set in a send..(), recv..(), or setNextAddress() operation. To return 0 if successful, a negative number if not.

Implements XC::Channel.

◆ recvVector()

int XC::UDP_Socket::recvVector ( int  dbTag,
int  commitTag,
Vector theVector,
ChannelAddress theAddress = 0 
)
virtual

Invoked to receive the data in the Vector object theVector to another Channel object.

The object will obtain the data and size of the data to be sent by invoking getData() and getSize() on theVector. The channel object is then responsible for sending that data to the remote channel address given by theAddress. If theAddress is 0, the Channel sends to the Channel with the address last set in a send..()}, recv..(), or setNextAddress() operation. To return 0 if successful, a negative number if not.

Implements XC::Channel.

◆ sendID()

int XC::UDP_Socket::sendID ( int  dbTag,
int  commitTag,
const ID theID,
ChannelAddress theAddress = 0 
)
virtual

Invoked to receive the data in the ID object theID to another Channel object.

The object will obtain the data and size of the data to be sent by invoking getData() and getSize() on theID. The channel object is then responsible for sending that data to the remote channel address given by theAddress. If theAddress is 0, the Channel sends to the Channel with the address last set in a send..()}, recv..(), or setNextAddress() operation. To return 0 if successful, a negative number if not.

Implements XC::Channel.

◆ sendMatrix()

int XC::UDP_Socket::sendMatrix ( int  dbTag,
int  commitTag,
const Matrix theMatrix,
ChannelAddress theAddress = 0 
)
virtual

Invoked to receive the data in the Matrix object theMatrix to another Channel object.

The object will obtain the data and size of the data to be sent by invoking getData() and getSize() on theMatrix. The channel object is then responsible for sending that data to the remote channel address given by theAddress. If theAddress is 0, the Channel sends to the Channel with the address last set in a send..()}, recv..(), or setNextAddress() operation. To return 0 if successful, a negative number if not.

Implements XC::Channel.

◆ sendMsg()

int XC::UDP_Socket::sendMsg ( int  dbTag,
int  commitTag,
const Message theMsg,
ChannelAddress theAddress = 0 
)
virtual

A method invoked to send the data in the Message object theMsg to another Channel object.

The object will obtain the data and size of the data to be sent by invoking getData() and getSize() on theMsg. The channel object is then responsible for sending that data to the remote channel address given by theAddress. If theAddress is 0, the Channel sends to the Channel with the address last set in a send..()}, recv..(), or setNextAddress() operation. To return 0 if successful, a negative number if not.

Implements XC::Channel.

◆ sendVector()

int XC::UDP_Socket::sendVector ( int  dbTag,
int  commitTag,
const Vector theVector,
ChannelAddress theAddress = 0 
)
virtual

Invoked to receive the data in the Vector object theVector to another Channel object.

The object will obtain the data and size of the data to be sent by invoking getData() and getSize() on theVector. The channel object is then responsible for sending that data to the remote channel address given by theAddress. If theAddress is 0, the Channel sends to the Channel with the address last set in a send..()}, recv..(), or setNextAddress() operation. To return 0 if successful, a negative number if not.

Implements XC::Channel.

◆ setNextAddress()

int XC::UDP_Socket::setNextAddress ( const ChannelAddress theAddress)
virtual

A method invoked to set specify the next address that the next messages to be sent if {sendMessage()} or received if {recvMessage()} is invoked with a null pointer.

Implements XC::Channel.


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