Public Member Functions | Protected Attributes

wosh::WoshHost Class Reference

The class holds basic information about a generic WOSH host over the distributed system. More...

#include <H:/WOSH/win32_vc2010/src/core/WoshHost.h>

List of all members.

Public Member Functions

 WoshHost ()
 Empty constructor.
 WoshHost (const std::string &name)
 Constructor with initializer.
 WoshHost (const WoshHost &m)
 Copy constructor.
virtual ~WoshHost ()
 Empty destructor.
Getters
int64 getSeen () const
 Get the timestamp of the object. Timestamp is related to local time. Refers to last-seen timestamp of the remote host (by local-host point of view)
std::string getIP0 () const
 Get the timestamp of the object. Timestamp is related to remote time. Refers to last-seen timestamp of the remote host (by local-host point of view) Generally, the difference with getSeen() refers to the time-offset between hosts.
int getHopsCount () const
 Get the distance between local host and remote host (as number of hops). The WoshHost representing localhost, will have this field set to 0, a direct neighbour is 1-hop and so on.
bool isTimedOut (long span_seconds=0) const
 Evaluate if the host timed-out respect last-seen time and notify frequency.
long getNotifyFrequency () const
long getNotifyFrequency (short mode) const
int isConnected () const
int getKernelState () const
 Get the state of the Kernel.
std::string getBriefStatus () const
const std::map< long,
WoshDiscoveryInfo > & 
getDiscovery () const
std::map< long,
WoshDiscoveryInfo > & 
getDiscovery ()
const std::vector< std::string > & getProtocols () const
 Get the list of supported protocols. Elements order is undefined. Each entry defines a supported protocol, such as TCP://192.168.0.1:9595.
std::vector< std::string > & getProtocols ()
const std::vector
< WoshConnection > & 
getConnections () const
std::vector< WoshConnection > & getConnections ()
int getNeighbours (std::map< std::string, long > &neighbours) const
int getNeighbours (std::vector< std::string > &neighbours) const
const std::vector< std::string > & getBusses () const
std::vector< std::string > & getBusses ()
bool hasBus (const std::string &bus_name) const
const WoshHostStats & getStats () const
WoshHostStats & getStats ()
PropertygetProperty (const std::string &key) const
 Get the value of givedn field as Property. Permission is inherited by current object permission.
TablegetProperties () const
 Get the properties of the object, collected in a table. Properties are stored as Variant (two columns: key, value)
Setters
void setSeen ()
 Set the local timestamp of the object to current local time (epoch). Refers to last-seen timestamp of the remote host (by local-host point of view)
void setSeen (int64 time)
 Set the local timestamp (epoch) of the object (respect to local time).
void setHopsCount (int distance_hops)
 Set the distance between local host and remote host (as number of hops). The WoshHost representing localhost, will have this field set to 0, a direct neighbour is 1-hop and so on.
void setKernelState (int value)
 Set the state of the Kernel.
void setProtocols (const std::vector< std::string > &protos)
bool addProtocol (const std::string &value)
int addProtocols (const std::vector< std::string > &protos)
void setBusses (const std::vector< std::string > &shared_busses)
void setConnections (const std::vector< WoshConnection > &conns)
bool addNeighbour (const std::string &hostname, long timestamp=-2)
int addNeighbours (const std::map< std::string, long > &neighbours)
int addNeighbours (const std::vector< std::string > &neighbours)
int removeNeighbour (const std::string &hostname)
bool addConnection (const WoshConnection &connection)
bool removeConnection (const WoshConnection &connection)
void setDiscovery (const std::map< long, WoshDiscoveryInfo > &info)
void clear ()
 Clear the object (all fields).
Operators Overloading
virtual WoshHostoperator= (const WoshHost &m)
virtual bool operator== (const WoshHost &other) const
virtual bool operator!= (const WoshHost &other) const
Serialization interface
virtual std::string toString () const
virtual bool updateHash (DataHashContext *hash_context) const

Protected Attributes

int hopsCount
 numbers of hops needed to send a message from localhost
int kernel_state
 state of the kernel - NOT USED YET
int64 lastSeen
 when (epoch) host was last seen (by local-host)
std::vector< std::string > protocols
 supported protocols, ordered, should be the same on all host
std::vector< WoshConnection > connections
 current connections, ordered, should be the same on all host
std::map< long, WoshDiscoveryInfo > discoveryInfos
 discovery services info
std::vector< std::string > busses
 shared busses, should be the same on all host

Detailed Description

The class holds basic information about a generic WOSH host over the distributed system.

See also:
wosh::NetworkManager
wosh::bundles::DiscoveryBundle
Version:
0.8.711
Id:
WoshHost.h 3775 2011-01-01 16:38:17Z alex
Author:
Alessandro Polo

Definition at line 412 of file WoshHost.h.


Constructor & Destructor Documentation

wosh::WoshHost::WoshHost (  )

Empty constructor.

Definition at line 53 of file WoshHost.cpp.

wosh::WoshHost::WoshHost ( const std::string &  name )

Constructor with initializer.

Parameters:
name[in] the name of the host (such as 'wosh23')

Definition at line 60 of file WoshHost.cpp.

wosh::WoshHost::WoshHost ( const WoshHost m )

Copy constructor.

Parameters:
m[in] the source object to be copied

Definition at line 67 of file WoshHost.cpp.

virtual wosh::WoshHost::~WoshHost (  ) [inline, virtual]

Empty destructor.

Definition at line 436 of file WoshHost.h.


Member Function Documentation

void wosh::WoshHost::clear (  )

Clear the object (all fields).

Definition at line 83 of file WoshHost.cpp.

References busses, connections, discoveryInfos, hopsCount, kernel_state, lastSeen, protocols, wosh::Object::setName(), and wosh::Object::setPermission().

int wosh::WoshHost::getHopsCount (  ) const [inline]

Get the distance between local host and remote host (as number of hops). The WoshHost representing localhost, will have this field set to 0, a direct neighbour is 1-hop and so on.

Returns:
number of hops
See also:
setHopsCount()

Definition at line 468 of file WoshHost.h.

References hopsCount.

Referenced by wosh::NetworkManager::updateRemoteNeighbours_().

std::string wosh::WoshHost::getIP0 (  ) const

Get the timestamp of the object. Timestamp is related to remote time. Refers to last-seen timestamp of the remote host (by local-host point of view) Generally, the difference with getSeen() refers to the time-offset between hosts.

Returns:
timestamp (epoch) of the object (in milliseconds)
See also:
setSeen(), getSeen()

Definition at line 350 of file WoshHost.cpp.

References discoveryInfos.

int wosh::WoshHost::getKernelState (  ) const [inline]

Get the state of the Kernel.

Returns:
kernel state (WoshKernel::KERNEL_STATE) as integer
See also:
WoshKernel::getKernelState(), setKernelState()

Definition at line 490 of file WoshHost.h.

References kernel_state.

Table * wosh::WoshHost::getProperties (  ) const

Get the properties of the object, collected in a table. Properties are stored as Variant (two columns: key, value)

Returns:
new Table object, caller must care about releasing memory

Definition at line 434 of file WoshHost.cpp.

References connections, wosh::IReflection::getClassName(), wosh::Object::getName(), kernel_state, lastSeen, protocols, wosh::Table::set(), wosh::Table::setHeaderHorizontal(), and wosh::Table::setTableName().

Property * wosh::WoshHost::getProperty ( const std::string &  key ) const

Get the value of givedn field as Property. Permission is inherited by current object permission.

Parameters:
[in]keythe key field of the property (see defines)
Returns:
new Property object, caller must care about releasing memory
See also:
getProperties()

Definition at line 391 of file WoshHost.cpp.

References connections, wosh::IReflection::getClassName(), wosh::Object::getName(), wosh::Object::getPermission(), hopsCount, kernel_state, lastSeen, and protocols.

const std::vector<std::string>& wosh::WoshHost::getProtocols (  ) const [inline]

Get the list of supported protocols. Elements order is undefined. Each entry defines a supported protocol, such as TCP://192.168.0.1:9595.

Returns:
vector of strings, each string represents a supported protocol
See also:
setProtocols(), getConnections()

Definition at line 504 of file WoshHost.h.

References protocols.

int64 wosh::WoshHost::getSeen (  ) const [inline]

Get the timestamp of the object. Timestamp is related to local time. Refers to last-seen timestamp of the remote host (by local-host point of view)

Returns:
timestamp (epoch) of the object (in milliseconds)
See also:
setSeen(), getSeenRemote()

Definition at line 449 of file WoshHost.h.

References lastSeen.

bool wosh::WoshHost::isTimedOut ( long  span_seconds = 0 ) const

Evaluate if the host timed-out respect last-seen time and notify frequency.

Parameters:
[in]span_secondsthe accurancy of the evaluation in seconds
Returns:
false if notify-frequency is zero (or lower);
See also:
getSeen(), getNotifyFrequency()

Definition at line 307 of file WoshHost.cpp.

References lastSeen, and wosh::DateTime::std_time_ms().

void wosh::WoshHost::setHopsCount ( int  distance_hops ) [inline]

Set the distance between local host and remote host (as number of hops). The WoshHost representing localhost, will have this field set to 0, a direct neighbour is 1-hop and so on.

Parameters:
[in]distance_hopsnumber of hops
See also:
getHopsCount()

Definition at line 563 of file WoshHost.h.

References hopsCount.

Referenced by wosh::NetworkManager::updateRemoteNeighbours_().

void wosh::WoshHost::setKernelState ( int  value ) [inline]

Set the state of the Kernel.

Parameters:
[in]valuekernel state (WoshKernel::KERNEL_STATE) as integer
See also:
WoshKernel::getKernelState()

Definition at line 570 of file WoshHost.h.

References kernel_state.

void wosh::WoshHost::setSeen (  ) [inline]

Set the local timestamp of the object to current local time (epoch). Refers to last-seen timestamp of the remote host (by local-host point of view)

See also:
setSeen(-1), getSeen()

Definition at line 547 of file WoshHost.h.

References setSeen().

Referenced by wosh::NetworkManager::network_channel_incomingMessage(), setSeen(), and wosh::NetworkManager::updateRemoteNeighbours_().

void wosh::WoshHost::setSeen ( int64  time )

Set the local timestamp (epoch) of the object (respect to local time).

Parameters:
time[in] timestamp to be set, as epoch (seconds after 1970), when argument is set to '-1', function will set time using Utilities::std_time() call.
See also:
getSeen()

Definition at line 98 of file WoshHost.cpp.

References lastSeen, and wosh::DateTime::std_time_ms().


Member Data Documentation

std::vector<std::string> wosh::WoshHost::busses [protected]

shared busses, should be the same on all host

Definition at line 619 of file WoshHost.h.

Referenced by clear().

std::vector<WoshConnection> wosh::WoshHost::connections [protected]

current connections, ordered, should be the same on all host

Definition at line 617 of file WoshHost.h.

Referenced by clear(), getProperties(), and getProperty().

std::map<long,WoshDiscoveryInfo> wosh::WoshHost::discoveryInfos [protected]

discovery services info

Definition at line 618 of file WoshHost.h.

Referenced by clear(), and getIP0().

int wosh::WoshHost::hopsCount [protected]

numbers of hops needed to send a message from localhost

Definition at line 612 of file WoshHost.h.

Referenced by clear(), getHopsCount(), getProperty(), and setHopsCount().

state of the kernel - NOT USED YET

Definition at line 613 of file WoshHost.h.

Referenced by clear(), getKernelState(), getProperties(), getProperty(), and setKernelState().

int64 wosh::WoshHost::lastSeen [protected]

when (epoch) host was last seen (by local-host)

Definition at line 614 of file WoshHost.h.

Referenced by clear(), getProperties(), getProperty(), getSeen(), isTimedOut(), and setSeen().

std::vector<std::string> wosh::WoshHost::protocols [protected]

supported protocols, ordered, should be the same on all host

Definition at line 616 of file WoshHost.h.

Referenced by clear(), getProperties(), getProperty(), and getProtocols().


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

Generated on Tue Feb 8 2011 09:33:33 for WOSH system 0.8.888 [wolf] by Alessandro Polo, using DoxyGen 1.7.2 hosted by WOSH Framework