#include <source/ariba/utility/transport/tcpip/protlib/ie.h>
Public Member Functions | |
virtual | ~IEManager () |
virtual void | register_ie (const IE *ie) |
virtual void | register_ie (uint16 category, uint16 type, uint16 subtype, const IE *ie) |
virtual IE * | new_instance (uint16 category, uint16 type, uint16 subtype) |
virtual void | serialize (IE &ie, NetMsg &msg, IE::coding_t coding, uint32 &bytes_written) const |
virtual IE * | deserialize (NetMsg &msg, uint16 category, IE::coding_t coding, IEErrorList &errorlist, uint32 &bytes_read, bool skip=true)=0 |
Protected Member Functions | |
IEManager () | |
virtual IE * | lookup_ie (uint16 category, uint16 type, uint16 subtype) |
virtual void | throw_nomem_error () const |
Private Types | |
typedef hash_map< IE_Key, IE *, hash_IE_Key > | category_map_t |
Private Attributes | |
category_map_t | registry |
Each IE has to register at the IE Manager. The IEManager then provides methods to deserialize IEs from or serialize IEs to a NetMsg object. IEManager is abstract and thus can't be instantiated.
In contrast to earlier implementations, IEManager itself is no longer a singleton. Inheriting from singletons is a tricky business in C++ (and much easier in Java) because static methods can't be virtual. Because of this, multiple badly implemented child classes were unable to coexist in a single program.
The following has to be done in each protocol to use IEManager and create a protocol-specific singleton (called PROT_IEManager):
An example implementation can be found in the QSPEC code. Please note that old code (r286 and earlier) won't compile because of interface changes. The ability to register "default" IEs that are returned if no more specific IE is found has been removed because it depended on coding_t. If derived IEManagers need this functionality, they have to override lookup_ie().
Definition at line 439 of file ie.h.
typedef hash_map<IE_Key, IE *, hash_IE_Key> protlib::IEManager::category_map_t [private] |
virtual IE* protlib::IEManager::deserialize | ( | NetMsg & | msg, | |
uint16 | category, | |||
IE::coding_t | coding, | |||
IEErrorList & | errorlist, | |||
uint32 & | bytes_read, | |||
bool | skip = true | |||
) | [pure virtual] |
category_map_t protlib::IEManager::registry [private] |