From 89c0bc88bd4ebdc44dfb99235609c90e968af533 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 15 Nov 2009 14:20:13 +0000 Subject: added core::Info id, changed network info message, updated entity network message to include the info id --- src/core/info.h | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'src/core/info.h') diff --git a/src/core/info.h b/src/core/info.h index 0296ec9..8b9a89b 100644 --- a/src/core/info.h +++ b/src/core/info.h @@ -61,16 +61,31 @@ public: typedef std::deque Text; /** - * @brief create a new information record - * The constructor automaticly adds the instance to the registry + * @brief create a new server-side information record + * This constructor assigns an id + */ + Info(const InfoType *type); + + /** + * @brief create a new client-side information record + * This constructor doesn not assign an id */ - Info(const InfoType *type = 0); + Info(const InfoType *type, const std::string & label); + + /** + * @brief create a new client-side information record + */ + Info(const unsigned int id); /// delete the information record virtual ~Info(); /* ---- inspectors ------------------------------------------------- */ + inline const unsigned int id() const { + return info_id; + } + inline const InfoType* type() const { return info_type; } @@ -98,6 +113,8 @@ public: /* ---- mutators --------------------------------------------------- */ + void set_id(const unsigned int); + void set_modelname(const std::string & modelname); void set_modelname(const char *modelname); @@ -124,11 +141,9 @@ public: /// clear the timestamp void clear_timestamp(); -protected: - - /// set the info class id + /// set the info class type void set_type(const InfoType *type); - + public: /* ---- serializers ------------------------------------------------ */ @@ -140,6 +155,7 @@ public: private: const InfoType* info_type; + unsigned int info_id; long info_price; unsigned long info_timestamp; @@ -160,6 +176,9 @@ public: return info_registry; } + /// search the info registry for a record with the specified id + static Info *find(const unsigned int id); + /// search the info registry for a labeled item static Info *find(const char * label); @@ -181,6 +200,12 @@ public: /// clear the info registry static void clear(); + /// print the list header + static void list_header(); + + /// list a single record + static void list(const Info *info); + /// list the info registry static void list(); -- cgit v1.2.3