obby::basic_host_buffer< Document, Selector > Class Template Reference

#include <host_buffer.hpp>

Inheritance diagram for obby::basic_host_buffer< Document, Selector >:

obby::basic_local_buffer< Document, Selector > obby::basic_server_buffer< Document, Selector > obby::basic_buffer< Document, Selector > obby::basic_buffer< Document, Selector > List of all members.

Public Types

typedef basic_server_buffer<
Document, Selector >::base_document_info_type 
base_document_info_type
typedef basic_host_document_info<
Document, Selector > 
document_info_type
typedef basic_server_buffer<
Document, Selector >::base_net_type 
base_net_type
typedef net6::basic_host<
Selector > 
net_type

Public Member Functions

 basic_host_buffer (const std::string &username, const colour &colour)
virtual void open (unsigned int port)
virtual void open (const std::string &session, unsigned int port)
document_info_typedocument_find (unsigned int owner_id, unsigned int id) const
virtual const userget_self () const
virtual void send_message (const std::string &message)
virtual void send_message (const std::string &message, const user &to)
virtual void send_command (const command_query &query)
 Executes a command.
virtual void document_create (const std::string &title, const std::string &encoding, const std::string &content)
virtual void set_colour (const colour &colour)

Protected Member Functions

virtual base_document_info_typenew_document_info (const user *owner, unsigned int id, const std::string &title, const std::string &encoding, const std::string &content)
virtual base_document_info_typenew_document_info (const serialise::object &obj)
virtual base_net_typenew_net ()
void on_user_table_deserialised ()
 Creates the local user after the user table has been deserialised.
virtual void session_close ()
 Closes the session.
void session_close_impl ()
 Implementation of session_close() that does not call a base function.

Protected Attributes

std::string m_username
colour m_colour
const userm_self

Private Member Functions

void init_impl ()
 Common initialisation function called by both constructors to avoid code duplication.
net_typenet6_host ()
const net_typenet6_host () const

Detailed Description

template<typename Document, typename Selector>
class obby::basic_host_buffer< Document, Selector >

Definition at line 33 of file host_buffer.hpp.


Member Typedef Documentation

template<typename Document, typename Selector>
typedef basic_server_buffer<Document, Selector>:: base_document_info_type obby::basic_host_buffer< Document, Selector >::base_document_info_type

Reimplemented from obby::basic_local_buffer< Document, Selector >.

Definition at line 40 of file host_buffer.hpp.

template<typename Document, typename Selector>
typedef basic_host_document_info<Document, Selector> obby::basic_host_buffer< Document, Selector >::document_info_type

Reimplemented from obby::basic_local_buffer< Document, Selector >.

Definition at line 43 of file host_buffer.hpp.

template<typename Document, typename Selector>
typedef basic_server_buffer<Document, Selector>:: base_net_type obby::basic_host_buffer< Document, Selector >::base_net_type

Reimplemented from obby::basic_local_buffer< Document, Selector >.

Definition at line 47 of file host_buffer.hpp.

template<typename Document, typename Selector>
typedef net6::basic_host<Selector> obby::basic_host_buffer< Document, Selector >::net_type

Reimplemented from obby::basic_local_buffer< Document, Selector >.

Definition at line 49 of file host_buffer.hpp.


Constructor & Destructor Documentation

template<typename Document, typename Selector>
obby::basic_host_buffer< Document, Selector >::basic_host_buffer ( const std::string &  username,
const colour colour 
)

Creates a new host_buffer.

Parameters:
username User name for the local user.
colour Local user colour.

Definition at line 166 of file host_buffer.hpp.

References obby::basic_host_buffer< Document, Selector >::init_impl().


Member Function Documentation

template<typename Document, typename Selector>
void obby::basic_host_buffer< Document, Selector >::open ( unsigned int  port  )  [virtual]

Opens the server on the given port.

Reimplemented from obby::basic_server_buffer< Document, Selector >.

Definition at line 177 of file host_buffer.hpp.

References obby::basic_host_buffer< Document, Selector >::m_self, and obby::basic_host_buffer< Document, Selector >::on_user_table_deserialised().

template<typename Document, typename Selector>
void obby::basic_host_buffer< Document, Selector >::open ( const std::string &  session,
unsigned int  port 
) [virtual]

Opens the server on the given port and resumes the obby session stored in the given file.

Reimplemented from obby::basic_server_buffer< Document, Selector >.

Definition at line 188 of file host_buffer.hpp.

References obby::basic_host_buffer< Document, Selector >::m_self.

template<typename Document, typename Selector>
basic_host_buffer< Document, Selector >::document_info_type * obby::basic_host_buffer< Document, Selector >::document_find ( unsigned int  owner_id,
unsigned int  id 
) const

Looks for a document with the given ID which belongs to the user with the given owner ID. Note that we do not take a real user object here because the ID is enough and one might not have a user object to the corresponding ID. So a time-consuming lookup is obsolete.

Reimplemented from obby::basic_local_buffer< Document, Selector >.

Definition at line 200 of file host_buffer.hpp.

template<typename Document, typename Selector>
const user & obby::basic_host_buffer< Document, Selector >::get_self (  )  const [virtual]

Returns the local user.

Implements obby::basic_local_buffer< Document, Selector >.

Definition at line 212 of file host_buffer.hpp.

References obby::basic_host_buffer< Document, Selector >::m_self.

Referenced by obby::basic_host_document_info< Document, Selector >::insert(), obby::basic_host_buffer< Document, Selector >::on_user_table_deserialised(), obby::basic_host_document_info< Document, Selector >::subscribe(), and obby::basic_host_document_info< Document, Selector >::unsubscribe().

template<typename Document, typename Selector>
void obby::basic_host_buffer< Document, Selector >::send_message ( const std::string &  message  )  [virtual]

Sends a global message to all users.

Reimplemented from obby::basic_server_buffer< Document, Selector >.

Definition at line 228 of file host_buffer.hpp.

References obby::basic_host_buffer< Document, Selector >::m_self.

template<typename Document, typename Selector>
void obby::basic_host_buffer< Document, Selector >::send_message ( const std::string &  message,
const user to 
) [virtual]

Sends a message to the given user.

Reimplemented from obby::basic_server_buffer< Document, Selector >.

Definition at line 248 of file host_buffer.hpp.

References obby::basic_host_buffer< Document, Selector >::m_self.

template<typename Document, typename Selector>
void obby::basic_host_buffer< Document, Selector >::send_command ( const command_query query  )  [virtual]

Executes a command.

Implements obby::basic_local_buffer< Document, Selector >.

Definition at line 269 of file host_buffer.hpp.

References obby::command_map::exec_command(), obby::basic_server_buffer< Document, Selector >::m_command_map, and obby::basic_host_buffer< Document, Selector >::m_self.

template<typename Document, typename Selector>
void obby::basic_host_buffer< Document, Selector >::document_create ( const std::string &  title,
const std::string &  encoding,
const std::string &  content 
) [virtual]

Creates a new document with predefined content. signal_insert_document will be emitted and may be used to access the resulting obby::document.

Reimplemented from obby::basic_server_buffer< Document, Selector >.

Definition at line 289 of file host_buffer.hpp.

References obby::basic_host_buffer< Document, Selector >::m_self.

template<typename Document, typename Selector>
void obby::basic_host_buffer< Document, Selector >::set_colour ( const colour colour  )  [virtual]

Sets a new colour for the local user.

Implements obby::basic_local_buffer< Document, Selector >.

Definition at line 312 of file host_buffer.hpp.

References obby::basic_host_buffer< Document, Selector >::m_self, and obby::basic_local_buffer< Document, Selector >::m_signal_user_colour_failed.

template<typename Document, typename Selector>
basic_host_buffer< Document, Selector >::base_document_info_type * obby::basic_host_buffer< Document, Selector >::new_document_info ( const user owner,
unsigned int  id,
const std::string &  title,
const std::string &  encoding,
const std::string &  content 
) [protected, virtual]

Creates a new document info object according to the type of buffer.

Reimplemented from obby::basic_server_buffer< Document, Selector >.

Definition at line 381 of file host_buffer.hpp.

References obby::basic_host_buffer< Document, Selector >::net6_host().

template<typename Document, typename Selector>
basic_host_buffer< Document, Selector >::base_document_info_type * obby::basic_host_buffer< Document, Selector >::new_document_info ( const serialise::object obj  )  [protected, virtual]

Creates a new document info deserialised from a serialisation object according to the type of buffer.

Reimplemented from obby::basic_server_buffer< Document, Selector >.

Definition at line 402 of file host_buffer.hpp.

References obby::basic_host_buffer< Document, Selector >::net6_host().

template<typename Document, typename Selector>
basic_host_buffer< Document, Selector >::base_net_type * obby::basic_host_buffer< Document, Selector >::new_net (  )  [protected, virtual]

Creates the underlaying net6 network object corresponding to the buffer's type.

Reimplemented from obby::basic_server_buffer< Document, Selector >.

Definition at line 410 of file host_buffer.hpp.

References obby::basic_host_buffer< Document, Selector >::m_username.

template<typename Document, typename Selector>
void obby::basic_host_buffer< Document, Selector >::on_user_table_deserialised (  )  [protected]

Creates the local user after the user table has been deserialised.

Definition at line 340 of file host_buffer.hpp.

References obby::basic_host_buffer< Document, Selector >::get_self(), obby::basic_host_buffer< Document, Selector >::m_colour, obby::basic_host_buffer< Document, Selector >::m_self, and obby::basic_host_buffer< Document, Selector >::net6_host().

Referenced by obby::basic_host_buffer< Document, Selector >::init_impl(), and obby::basic_host_buffer< Document, Selector >::open().

template<typename Document, typename Selector>
void obby::basic_host_buffer< Document, Selector >::session_close (  )  [protected, virtual]

Closes the session.

Reimplemented from obby::basic_local_buffer< Document, Selector >.

Definition at line 353 of file host_buffer.hpp.

References obby::basic_host_buffer< Document, Selector >::session_close_impl().

template<typename Document, typename Selector>
void obby::basic_host_buffer< Document, Selector >::session_close_impl (  )  [protected]

Implementation of session_close() that does not call a base function.

Reimplemented from obby::basic_local_buffer< Document, Selector >.

Definition at line 361 of file host_buffer.hpp.

Referenced by obby::basic_host_buffer< Document, Selector >::session_close().

template<typename Document, typename Selector>
void obby::basic_host_buffer< Document, Selector >::init_impl (  )  [private]

Common initialisation function called by both constructors to avoid code duplication.

Definition at line 367 of file host_buffer.hpp.

References obby::user_table::deserialised_event(), obby::basic_buffer< Document, Selector >::m_user_table, and obby::basic_host_buffer< Document, Selector >::on_user_table_deserialised().

Referenced by obby::basic_host_buffer< Document, Selector >::basic_host_buffer().

template<typename Document, typename Selector>
basic_host_buffer< Document, Selector >::net_type & obby::basic_host_buffer< Document, Selector >::net6_host (  )  [private]

This function provides access to the underlaying net6::basic_host object.

Definition at line 417 of file host_buffer.hpp.

Referenced by obby::basic_host_buffer< Document, Selector >::new_document_info(), and obby::basic_host_buffer< Document, Selector >::on_user_table_deserialised().

template<typename Document, typename Selector>
const basic_host_buffer< Document, Selector >::net_type & obby::basic_host_buffer< Document, Selector >::net6_host (  )  const [private]

This function provides access to the underlaying net6::basic_host object.

Definition at line 426 of file host_buffer.hpp.


Member Data Documentation

template<typename Document, typename Selector>
std::string obby::basic_host_buffer< Document, Selector >::m_username [protected]

Definition at line 141 of file host_buffer.hpp.

Referenced by obby::basic_host_buffer< Document, Selector >::new_net().

template<typename Document, typename Selector>
colour obby::basic_host_buffer< Document, Selector >::m_colour [protected]

Definition at line 142 of file host_buffer.hpp.

Referenced by obby::basic_host_buffer< Document, Selector >::on_user_table_deserialised().

template<typename Document, typename Selector>
const user* obby::basic_host_buffer< Document, Selector >::m_self [protected]

Definition at line 144 of file host_buffer.hpp.

Referenced by obby::basic_host_buffer< Document, Selector >::document_create(), obby::basic_host_buffer< Document, Selector >::get_self(), obby::basic_host_buffer< Document, Selector >::on_user_table_deserialised(), obby::basic_host_buffer< Document, Selector >::open(), obby::basic_host_buffer< Document, Selector >::send_command(), obby::basic_host_buffer< Document, Selector >::send_message(), and obby::basic_host_buffer< Document, Selector >::set_colour().


The documentation for this class was generated from the following file:
Generated on Fri Jan 11 10:01:33 2008 for obby by  doxygen 1.5.1