[Xorp-cvs] XORP cvs commit: xorp/libproto

Pavlin Radoslavov pavlin@icir.org
Tue, 27 Sep 2005 17:20:05 GMT


CVSROOT:	/usr/local/share/doc/apache/cvs
Module name:	xorp
Changes by:	pavlin@xorpc.icir.org	2005-09-27 17:20:05 UTC

XORP CVS repository


Modified files:
	libproto      config_node_id.hh test_config_node_id.cc 

Log message:
	* Refactor the implementation of class ConfigNodeId:
	  - The node ID is composed of two uint64_t integers.
	    Now the first integer is the unique node ID. The second integer is
	    the node positiion and is set to the unique node ID of the previous
	    node. If it is the first node, then the position is set to 0.
	    The upper half of the unique node ID (the most significant 32 bits)
	    is the instance ID. The lower half of the unique node ID (the least
	    significant 32 bits) is the unique part of the node ID for that
	    instance.
	
	  - Add more methods: copy_in(), operator==,
	    generate_unique_node_id() method to generate a new unique node ID,
	    etc.
	
	* Add a new template class ConfigNodeIdMap which is used for storing the
	  mapping between a ConfigNodeId node and the corresponding value.
	  Internally the class is implemented as a mapped linked list:
	  - A linked list of pairs <ConfigNodeId, typename V> contains
	    the ConfigNodeId nodes and the corresponding values.
	  - An STL <map> stores the mapping between unique node IDs and the
	    corresponding iterators in the above list.
	
	  The advantage of such implementation is that the time to insert and
	  remove entries to/from the list is similar to the time to perform
	  those operations on an STL map container.
	
	* Modify the test_config_node_id test program to reflect the above
	  modifications to class ConfigNodeId, and to include tests for
	  the new ConfigNodeIdMap class.

Revision  Changes                                 Path
1.2       +410 -29;  commitid: 134843397bfb7ea6;  xorp/libproto/config_node_id.hh
1.2       +215 -16;  commitid: 134843397bfb7ea6;  xorp/libproto/test_config_node_id.cc