ParCompMark::NetServer Class Reference
#include <PCMNetServer.h>
Inheritance diagram for ParCompMark::NetServer:
Detailed Description
Network server class.
Definition at line 48 of file PCMNetServer.h.
Methods | |
virtual void | initialize () |
Initialize the class (server thread, broadcast send). | |
virtual void | finalize () |
Initialize the class (broadcast recieve thread). | |
virtual void | sendBroadcastMessage (const std::string &type, const std::string &message) |
Send a broadcast message. | |
virtual void | buildCluster () |
Build cluster information. | |
virtual void | task () |
Thread for accept TCP/IP connection. | |
Public Types | |
typedef ParCompMark::Pointer< NetServer, DummyLock > | Pointer |
Type for pointer to this class. | |
typedef ParCompMark::Pointer< int, Mutex > | IntPointer |
Type for pointer to an int. | |
Public Member Functions | |
Constructors & destructor | |
NetServer (const std::string &name) | |
Create network class. | |
virtual | ~NetServer () |
The destructor. | |
Getters & setters | |
sockaddr_in & | getBroadcastAddress () const |
Getter of mBroadcastAddress. | |
const u32 & | getMaxConnection () const |
Getter of mMaxConnection. | |
const u32 & | getHostNumber () const |
Getter of mHostNumber. | |
void | setHostNumber (const u32 &hostnumber) |
Setter of mHostNumber. | |
const NetServer::IntPointer & | getRecievedNumber () const |
Getter of mRecievedNumber. | |
const NetServer::IntPointer & | getStopFrameID () const |
Getter of mStopFrameID. | |
Protected Attributes | |
Variables | |
sockaddr_in | mBroadcastAddress |
The broadcast address structure for send later time. | |
u32 | mMaxConnection |
| |
u32 | mHostNumber |
Number if the host in the cluster. | |
IntPointer | mRecievedNumber |
Number of the recieved message for a broadcast. | |
IntPointer | mStopFrameID |
Frame id for stop PC. |
Member Typedef Documentation
typedef ParCompMark::Pointer< int, Mutex > ParCompMark::NetServer::IntPointer |
Type for pointer to this class.
Reimplemented from ParCompMark::Network.
Definition at line 66 of file PCMNetServer.h.
Constructor & Destructor Documentation
ParCompMark::NetServer::NetServer | ( | const std::string & | name | ) |
Create network class.
- Parameters:
-
[in] name Name of the network.
Definition at line 38 of file PCMNetServer.cpp.
References ParCompMark::Network::getIP(), ParCompMark::Pointer< T, Lock >::getPtr(), initialize(), mHostNumber, mMaxConnection, and mStopFrameID.
Here is the call graph for this function:
ParCompMark::NetServer::~NetServer | ( | ) | [virtual] |
The destructor.
This class has virtual destructor.
Definition at line 65 of file PCMNetServer.cpp.
References finalize(), and ParCompMark::Network::mInitialized.
Here is the call graph for this function:
Member Function Documentation
void ParCompMark::NetServer::buildCluster | ( | ) | [virtual] |
Build cluster information.
Definition at line 202 of file PCMNetServer.cpp.
References ParCompMark::Singleton< T >::getInstance(), mHostNumber, sendBroadcastMessage(), and ParCompMark::Timer::sleep().
Referenced by ParCompMark::Application::autoDetection().
Here is the call graph for this function:
void ParCompMark::NetServer::finalize | ( | ) | [virtual] |
Initialize the class (broadcast recieve thread).
Definition at line 149 of file PCMNetServer.cpp.
References Assert, ParCompMark::Network::mBroadcastSocket, ParCompMark::Network::mInitialized, and ParCompMark::Network::mStreamSocket.
Referenced by ~NetServer().
struct sockaddr_in & ParCompMark::NetServer::getBroadcastAddress | ( | ) | const [inline] |
Getter of mBroadcastAddress.
Returns value of mBroadcastAddress.
- Returns:
- The value of mBroadcastAddress
Definition at line 270 of file PCMNetServer.h.
const u32 & ParCompMark::NetServer::getHostNumber | ( | ) | const [inline] |
Getter of mHostNumber.
Returns value of mHostNumber.
- Returns:
- The value of mHostNumber
Definition at line 284 of file PCMNetServer.h.
const u32 & ParCompMark::NetServer::getMaxConnection | ( | ) | const [inline] |
Getter of mMaxConnection.
Returns value of mMaxConnection.
- Returns:
- The value of mMaxConnection
Definition at line 277 of file PCMNetServer.h.
const NetServer::IntPointer & ParCompMark::NetServer::getRecievedNumber | ( | ) | const [inline] |
Getter of mRecievedNumber.
Returns value of mRecievedNumber.
- Returns:
- The value of mRecievedNumber
Definition at line 298 of file PCMNetServer.h.
const NetServer::IntPointer & ParCompMark::NetServer::getStopFrameID | ( | ) | const [inline] |
Getter of mStopFrameID.
Returns value of mStopFrameID.
- Returns:
- The value of mStopFrameID
Definition at line 305 of file PCMNetServer.h.
Referenced by ParCompMark::Application::_stop().
void ParCompMark::NetServer::initialize | ( | ) | [virtual] |
Initialize the class (server thread, broadcast send).
Definition at line 79 of file PCMNetServer.cpp.
References Assert, Except, ParCompMark::Singleton< T >::getInstance(), ParCompMark::Pointer< T, Lock >::getPtr(), ParCompMark::Thread::initThread(), ParCompMark::Pointer< T, Lock >::lock(), mBroadcastAddress, ParCompMark::Network::mBroadcastPort, ParCompMark::Network::mBroadcastSocket, ParCompMark::Network::mCommunicationPort, ParCompMark::Network::mIfConfs, ParCompMark::Network::mInitialized, mMaxConnection, mRecievedNumber, ParCompMark::Network::mStreamSocket, ParCompMark::Logger::NOTICE, and ParCompMark::Pointer< T, Lock >::unlock().
Referenced by NetServer().
Here is the call graph for this function:
void ParCompMark::NetServer::sendBroadcastMessage | ( | const std::string & | type, | |
const std::string & | message | |||
) | [virtual] |
Send a broadcast message.
- Parameters:
-
[in] type Type of the message. [in] message The message.
Definition at line 170 of file PCMNetServer.cpp.
References Except, ParCompMark::Singleton< T >::getInstance(), ParCompMark::Pointer< T, Lock >::getPtr(), ParCompMark::Pointer< T, Lock >::lock(), mBroadcastAddress, ParCompMark::Network::mBroadcastSocket, mHostNumber, mRecievedNumber, ParCompMark::Logger::NOTICE, ParCompMark::Pointer< T, Lock >::unlock(), and ParCompMark::Thread::wait().
Referenced by ParCompMark::Application::_pseudoStop(), ParCompMark::Application::_quit(), ParCompMark::Application::_start(), ParCompMark::Application::_stop(), buildCluster(), and ParCompMark::Application::calculateMessageSendTime().
Here is the call graph for this function:
void ParCompMark::NetServer::setHostNumber | ( | const u32 & | hostnumber | ) | [inline] |
Setter of mHostNumber.
Sets value of mHostNumber.
- Parameters:
-
[in] hostnumber The value of mHostNumber
Definition at line 291 of file PCMNetServer.h.
void ParCompMark::NetServer::task | ( | ) | [protected, virtual] |
Thread for accept TCP/IP connection.
Reimplemented from ParCompMark::Thread.
Definition at line 245 of file PCMNetServer.cpp.
References ParCompMark::Logger::DEBUG, Except, ParCompMark::Singleton< T >::getInstance(), ParCompMark::Thread::initThread(), ParCompMark::Network::mOwnIP, ParCompMark::Network::mStreamSocket, ParCompMark::Client::setServerIP(), ParCompMark::Network::setStreamSocket(), and ParCompMark::Thread::startThread().
Here is the call graph for this function:
Member Data Documentation
struct sockaddr_in ParCompMark::NetServer::mBroadcastAddress [protected] |
The broadcast address structure for send later time.
- Remarks:
- This is own attribute of this class.
Definition at line 86 of file PCMNetServer.h.
Referenced by initialize(), and sendBroadcastMessage().
u32 ParCompMark::NetServer::mHostNumber [protected] |
Number if the host in the cluster.
- Remarks:
- This is own attribute of this class.
Definition at line 100 of file PCMNetServer.h.
Referenced by buildCluster(), NetServer(), and sendBroadcastMessage().
u32 ParCompMark::NetServer::mMaxConnection [protected] |
- Remarks:
- This is own attribute of this class.
Definition at line 93 of file PCMNetServer.h.
Referenced by initialize(), and NetServer().
IntPointer ParCompMark::NetServer::mRecievedNumber [protected] |
Number of the recieved message for a broadcast.
- Remarks:
- This is own attribute of this class.
Definition at line 107 of file PCMNetServer.h.
Referenced by initialize(), and sendBroadcastMessage().
IntPointer ParCompMark::NetServer::mStopFrameID [protected] |
Frame id for stop PC.
- Remarks:
- This is own attribute of this class.
Definition at line 114 of file PCMNetServer.h.
Referenced by NetServer().
The documentation for this class was generated from the following files: