Entire Class Index | Main Class Index | Cross Index | Global Index

# Class CL_NetObject

Network replication object.
Contained in: global
Derived from: none
Derived by: none
Group: Network (NetObjects)

#include <ClanLib/network.h>

### public function member index:
### Construction:
`` | `CL_NetObject` | `(`const` `CL_NetObject`& `copy`)`;
`` | `CL_NetObject` | `(`class` `CL_NetObjectChannel`* `obj_channel`)`;
`` | `CL_NetObject` | `(`int` `obj_id`, `class` `CL_NetObjectChannel`* `obj_channel`)`;
``virtual`` | `~CL_NetObject` | `()`;
### Attributes:
``int`` | `get_obj_id` | `() `const``;
``bool`` | `is_server` | `() `const``;
### Operations:
``CL_Slot`` | `connect` | `(`int` `msg_type`, `CL_Slot_v1`<`class` `CL_InputSource`& >* `slot`)`;
``CL_Slot`` | `connect` | `(`int` `msg_type`, `void` (*`callback`)(`class` `CL_InputSource`& ))`;
``CL_Slot`` | `connect` | `(`int` `talkback_type`, `CL_Slot_v2`<`const` `class` `CL_NetComputer`& , `class` `CL_InputSource`& >* `slot`)`;
``CL_Slot`` | `connect` | `(`int` `talkback_type`, `void` (*`callback`)(`const` `class` `CL_NetComputer`& , `class` `CL_InputSource`& ))`;
``void`` | `send` | `(`int` `msg_type`, `const` `std::string`& `message`)`;
``void`` | `talkback` | `(`int` `talkback_type`, `const` `std::string`& `message`)`;

## Description:

The netobject is a message dispatcher for objects being replicated over the network.
It provides an easy system for a server object to send messages to replicated clients on remote computers, as well as getting answers back.

## Function Member Descriptions:

CL_NetObject::CL_NetObject - Copy constructor.
`` `CL_NetObject``(`const` `CL_NetObject`& `copy`)`;

CL_NetObject::CL_NetObject - Construct a new netobject, assigning it an unique handle that identifies it over the network. Use this constructor to create a server side netobject.
`` `CL_NetObject``(`class` `CL_NetObjectChannel`* `obj_channel`)`;

CL_NetObject::CL_NetObject - Construct a netobject, assigning it the object handle obj_id. This is normally used to construct a client side netobject.
`` `CL_NetObject``(`int` `obj_id`, `class` `CL_NetObjectChannel`* `obj_channel`)`;

CL_NetObject::connect - Connect the slot to the specified message sub-type.
``CL_Slot`` `connect``(`int` `msg_type`, `CL_Slot_v1`<`class` `CL_InputSource`& >* `slot`)`;

CL_NetObject::connect - Connect the slot to the specified message sub-type.
``CL_Slot`` `connect``(`int` `msg_type`, `void` (*`callback`)(`class` `CL_InputSource`& ))`;

CL_NetObject::connect - Connect the slot to the specified talkback message sub-type.
``CL_Slot`` `connect``(`int` `talkback_type`, `CL_Slot_v2`<`const` `class` `CL_NetComputer`& , `class` `CL_InputSource`& >* `slot`)`;

CL_NetObject::connect - Connect callback function slot.
``CL_Slot`` `connect``(`int` `talkback_type`, `void` (*`callback`)(`const` `class` `CL_NetComputer`& , `class` `CL_InputSource`& ))`;

CL_NetObject::get_obj_id - Returns the netobject handle that identifies it over the network.
``int`` `get_obj_id``() `const``;

CL_NetObject::is_server - Returns true if the netobject is a server side object.
``bool`` `is_server``() `const``;

CL_NetObject::send - Send a message to the client objects.
``void`` `send``(`int` `msg_type`, `const` `std::string`& `message`)`;

CL_NetObject::talkback - Send a message to the server objects.
``void`` `talkback``(`int` `talkback_type`, `const` `std::string`& `message`)`;

CL_NetObject::~CL_NetObject - NetObject destructor
``virtual`` `~CL_NetObject``()`;

## Variable Member Descriptions: