Order Class Reference

This represents the basic message that is passed around amongst the generals during operation. Each receiving general (regardless of loyalty) is obligated to append their Unique ID to the enclosed communication_path. A Loyal General will never modify the enclosed marching_orders, while Disloyal Generals may to cause as much confusion as possible. More...

#include <order.h>

List of all members.

Public Member Functions

 Order (const SharedMemoryUIntAllocator &alloc, MarchingOrders::type march_orders=MarchingOrders::kInvalid)
 Constructor.
 Order (const Order &o)
 Copy Constructor.
 ~Order ()
 Destructor.
void AppendCommPathEntry (const unsigned int kUniqueID)
 Helper function to add a general's unique ID to the communication_path.
boost::interprocess::string CommunicationPathToString () const
 Convert the enclosed communication path to a human readable string where unique IDs are delimited by a space. For example, if the communication path contains the General IDs 0 and 1, the output of this function would be "0 1".

Static Public Member Functions

static boost::interprocess::string MarchingOrderTypeToString (MarchingOrders::type marching_order)
 Helper function to convert a marching order to a human readable string. For example, MarchingOrders::kAttack will get converted to "Attack". This same paradigm applies to both "Retreat" and "Invalid".

Public Attributes

SharedMemoryUIntList communication_path
 A list of Generals' Unique IDs whom have seen this Order. The first entry was the General who created this Order, and the last entry is the currently owning General. All Generals who receive this Order are required to append their Unique ID to the list, preferably using AppendCommPathEntry.
MarchingOrders::type marching_orders
 The relayed Order.

Detailed Description

This represents the basic message that is passed around amongst the generals during operation. Each receiving general (regardless of loyalty) is obligated to append their Unique ID to the enclosed communication_path. A Loyal General will never modify the enclosed marching_orders, while Disloyal Generals may to cause as much confusion as possible.

Definition at line 43 of file order.h.


Constructor & Destructor Documentation

Order::Order ( const SharedMemoryUIntAllocator alloc,
MarchingOrders::type  march_orders = MarchingOrders::kInvalid 
)

Constructor.

Parameters:
alloc The allocator to use in the underlying communication_path
march_orders The initial marching orders to carry

Definition at line 16 of file order.cpp.

Order::Order ( const Order o  ) 

Copy Constructor.

Parameters:
o Order to copy

Definition at line 22 of file order.cpp.

Order::~Order (  ) 

Destructor.

Definition at line 27 of file order.cpp.


Member Function Documentation

void Order::AppendCommPathEntry ( const unsigned int  kUniqueID  ) 

Helper function to add a general's unique ID to the communication_path.

Parameters:
kUniqueID General's Unique ID

Definition at line 55 of file order.cpp.

Here is the caller graph for this function:

boost::interprocess::string Order::CommunicationPathToString (  )  const

Convert the enclosed communication path to a human readable string where unique IDs are delimited by a space. For example, if the communication path contains the General IDs 0 and 1, the output of this function would be "0 1".

Returns:
Communication path as a string

Definition at line 59 of file order.cpp.

boost::interprocess::string Order::MarchingOrderTypeToString ( MarchingOrders::type  marching_order  )  [static]

Helper function to convert a marching order to a human readable string. For example, MarchingOrders::kAttack will get converted to "Attack". This same paradigm applies to both "Retreat" and "Invalid".

Parameters:
marching_order Marching order to convert
Returns:
Human friendly converted string

Definition at line 31 of file order.cpp.

Here is the caller graph for this function:


Member Data Documentation

A list of Generals' Unique IDs whom have seen this Order. The first entry was the General who created this Order, and the last entry is the currently owning General. All Generals who receive this Order are required to append their Unique ID to the list, preferably using AppendCommPathEntry.

Definition at line 53 of file order.h.

The relayed Order.

Definition at line 58 of file order.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
Generated on Mon May 31 15:35:43 2010 for Byzantine Generals Coding Sample by  doxygen 1.6.3