mace Namespace Reference


Detailed Description

Namespace for mace-specific types.

As many types in Mace collide with types in the global or std namespace, we put ours in the mace namespace.


Classes

class  AddressCacheEntry
 Entry in an address cache, contains an _id, a start and end for a range, and a timestamp it was refreshed. More...
class  AddressCache
 Implements a cache for Bamboo, Pastry, or Chord, which tracks the address range of peers. More...
class  Map
 Map class -- undocumented. More...
class  BinaryLogObject
 Defines a base class for all extensible binary logs for use with logreader. More...
class  CandidateMap
 Provides support for candidate sets as described in the AMMO/RanSub papers. More...
class  _SerializeArray
 Generic class for serializing arrays. More...
class  SerializeArray
 wrapper around _SerializeArray to provide Boost concept checking giving good error messages. More...
class  _SerializeList
 Generic class for serializing lists. More...
class  SerializeList
 wrapper around _SerializeList to provide Boost concept checking giving good error messages. More...
class  _SerializeSet
 Generic class for serializing sets. More...
class  SerializeSet
 wrapper around _SerializeSet to provide Boost concept checking giving good error messages. More...
class  _SerializeMap
 Generic class for serializing maps. More...
class  SerializeMap
 wrapper around _SerializeMap to provide Boost concept checking giving good error messages. More...
class  MapIterator
 Java-style iteration for C++ collections (next/hasNext). More...
class  ConstMapIterator
 Java-style const iteration for C++ collections (next/hasNext). More...
class  KeyRange
 A pair of MaceKey which represent an inclusive start, exclusive end circulur key range for hash addresses. More...
class  LRUCache
 Provides a cache with a least recently used replacement policy and a map like interface. More...
class  map
 mace::map extends std::map, but has support for printing and serialization, random element retrieval, and containsKey More...
class  SockAddr
 Helper class to represent an IP and port pair. More...
class  MaceAddr
 Helper class to represent Mace addresses. More...
class  MaceKey_interface
 The generic interface for MaceKey and its helper classes. More...
class  MaceKey
 The base class of Mace addresses. More...
class  MaceKeyDiff
 A class to represent the difference between two bit array MaceKey objects (big integers). (like TimeDiff in other languages). More...
class  MaceTime
 Simulator and Modelchecker friendly versions of time-of-day objects. Can be used for real execution too. More...
class  MaceTimeComparitor
 functor for ordering MaceTime objects sanely in a map in the simulator More...
class  MaceTimeEquality
 functor for equality testing MaceTime objects sanely in a map in the simulator More...
class  MaceTimeHash
 functor for hashing a MaceTime object More...
class  LogicalClock
class  array
 mace::array extends std::vector, but is fixed in size, provides printing and serialization More...
class  DB
 Mace-friendly object oriented interface to Berkeley DB. More...
class  deque
 mace::deque extends std::deque, provides contains(), erase(T), printability, and serializability More...
class  Message
 base class for all Messages in Mace More...
class  hash_map
 mace::hash_map extends std::hash_map, but provides Serialiable (optional), Printable, containsKey, get, and random More...
class  hash_set
 mace::hash_set extends std::hash_set, adds printability and optional serialization, contains, and random More...
class  list
 mace::list extends std::list, but has support for printing and optional serialization More...
class  multimap
 mace::multimap extends std::multimap, with support for printing and optional serialization, containsKey, get, and random More...
class  printpair
 implements the printable version of std::pair. More...
class  pair
 derives from mace::printpair, also adds serializability More...
class  set
 mace::set extends std::set, adds printability and optional serialization, contains, containsKey, set contains, and random element More...
class  sparse_array
 provides an interface like mace::array, but designed for sparse arrays More...
class  vector
 mace::vector extends std::vector, but has support for printing and optional serialization, random, and the ability to get an array pointer. More...
class  NodeCollection
 a hybrid set/map containing a collection of objects about nodes. More...
class  PrintPrintable
 Printable helper class which handles the toString methods by just implementing the print methods. More...
class  ToStringPrintable
 Printable helper class which handles the print methods by just implementing the toString methods. More...
class  ScopedFingerprint
 Used to compute a fingerprint of the call path of an event. More...
class  SSEReader
class  ScopedStackExecution
 Supports deferring actions and identifying event boundaries. More...
class  Serializer
 Base class for boost concept checking. Template parameter must derive from Serializer. More...
class  SoftState
 indicates that this serializer does nothing, a type deriving from it will not be Serializable More...
class  SerializationException
 exception for errors during serialization or deserialization More...
class  SerializationUtil
 Utility for helping with Xml serialization. More...
class  Serializable
 Objects which know how to serialize themselves. More...
class  SerializeConcept
 class for use with concept checking to make better error messages More...
class  Stopwatch
 used to measure cumulative time. More...
class  TemplateMap
 TemplateMap class -- undocumented. More...
class  KeyTraits
 Basic class with types and no special properties. More...

Typedefs

typedef BinaryLogObject *(* BinaryLogFactory )()
 Used for binary logging, this class allows associations between a log type (string) and an object which can deserialize the string.
typedef uint64_t MonotoneTime
 monotone times are just uint64_t timestamps, and should be strictly monotone increasing.
typedef std::string string
 once a full type, now just a typedef for std::string, as no special collection functionality other than print/serialize was implemented.

Functions

MaceKeyDiff operator- (const MaceKey &to, const MaceKey &from) throw (InvalidMaceKeyException)
 returns the length between two points on the circle (i.e. between the two ids in id-space).
MaceKey operator- (const MaceKey &, const MaceKeyDiff &) throw (InvalidMaceKeyException)
 subtracts a MaceKeyDiff from a MaceKey
MaceKey operator+ (const MaceKey &, const MaceKeyDiff &) throw (InvalidMaceKeyException)
 adds a MaceKeyDiff to a MaceKey
MaceKey operator+ (const MaceKey &, uint32_t) throw (InvalidMaceKeyException)
 adds a 32-bit integer as an implicit MaceKeyDiff
MaceKey operator- (const MaceKey &, uint32_t) throw (InvalidMaceKeyException)
 subtracts a 32-bit integer as an implicit MaceKeyDiff
MonotoneTime getmtime ()
 Use this method to get a MonotoneTime.
template<typename S>
const int noConvertToString (const S *dud)
 simple method to do nothing (for use by macro to compile out printing)
void printItem (std::ostream &out, const void *pitem)
 The printItem methods print the item passed in to the ostream.
template<typename S>
std::string mapToString (const S &m, bool newlines=false)
 Generic method to convert a map to a string by iterating through its elements.
template<typename S>
void printMap (std::ostream &os, const S &b, const S &e, bool newlines=false)
 Generic method to print a map (between two iterators) to a ostream object.
template<typename S>
void printMapState (std::ostream &os, const S &b, const S &e, bool newlines=false)
 Generic method to print a map state (between two iterators) to a ostream object (calling printState for the key and value).
template<typename S>
std::string listToString (const S &l, bool newlines=false)
 Generic method to return a list as a string.
template<typename S>
std::string listToString (const S &b, const S &e, bool newlines=false)
 Generic method to return a list (between two iterators) as a string.
template<typename S>
void printList (std::ostream &os, const S &b, const S &e, bool newlines=false)
 Generic method to print a list (between two iterators) to an ostream.
template<typename S>
std::string pointerListToString (const S &l, bool newlines=false)
 Generic method to return a list of pointers as a string.
template<typename S>
std::string convertToString (const S *pitem, const S &item)
 Generic method to convert any object to a string.
template<typename S>
void printState (std::ostream &out, const void *pitem, const S &item)
 Generic method to print any object in its state format.
template<typename S>
void printState (std::ostream &out, const Printable *pitem, const S &item)
 Generic method to print any object in its state format.
template<typename S>
void printListState (std::ostream &os, const S &b, const S &e, bool newlines=false)
 print a list (between two iterators) in state form
template<typename S>
void printXml (std::ostream &os, const void *pitem, const S &item)
 print any object in xml format
SerializablegetSerializable (void *pitem)
 returns a Serializable pointer if the object is Serializable, NULL otherwise. (uses static typing only)
SerializablegetSerializable (Serializable *pitem)
 returns a Serializable pointer if the object is Serializable, NULL otherwise. (uses static typing only)
const SerializablegetSerializable (const void *pitem)
 returns a Serializable const pointer if the object is Serializable, NULL otherwise. (uses static typing only)
const SerializablegetSerializable (const Serializable *pitem)
 returns a Serializable const pointer if the object is Serializable, NULL otherwise. (uses static typing only)
void serialize (std::string &str, const Serializable *pitem)
 serialize object onto str using the fact the object knows how to serialize itself
void serialize (std::string &str, const uint8_t *pitem)
 serialize object onto str using a simple append
void serialize (std::string &str, const uint16_t *pitem)
 serialize object onto str using htons()
void serialize (std::string &str, const uint32_t *pitem)
 serialize object onto str using htonl()
void serialize (std::string &str, const uint64_t *pitem)
 serialize object onto str using htonll()
void serialize (std::string &str, const int8_t *pitem)
 serialize object onto str using a simple append
void serialize (std::string &str, const int16_t *pitem)
 serialize object onto str using htons()
void serialize (std::string &str, const int32_t *pitem)
 serialize object onto str using htonl()
void serialize (std::string &str, const int64_t *pitem)
 serialize object onto str using htonll()
void serialize (std::string &str, const bool *pitem)
 treat pitem as a uint8_t and call serialize()
void serialize (std::string &str, const float *pitem)
void serialize (std::string &str, const double *pitem)
void serialize (std::string &str, const std::string *pitem)
 serialize a string onto a string by serializing first its size, then the contents
int deserialize (std::istream &in, Serializable *pitem) throw (SerializationException)
 deserialize an object, taking advantage that it knows how to deserialize itself (return bytes deserialized)
int deserialize (std::istream &in, int8_t *pitem) throw (SerializationException)
 read in a byte for the integer
int deserialize (std::istream &in, int16_t *pitem) throw (SerializationException)
 read in two bytes, using ntohs
int deserialize (std::istream &in, int32_t *pitem) throw (SerializationException)
 read in four bytes, using ntohl
int deserialize (std::istream &in, int64_t *pitem) throw (SerializationException)
 read in eight bytes, using ntohll
int deserialize (std::istream &in, uint8_t *pitem) throw (SerializationException)
 read in a byte for the integer
int deserialize (std::istream &in, uint16_t *pitem) throw (SerializationException)
 read in two bytes, using ntohs
int deserialize (std::istream &in, uint32_t *pitem) throw (SerializationException)
 read in four bytes, using ntohl
int deserialize (std::istream &in, uint64_t *pitem) throw (SerializationException)
 read in eight bytes, using ntohll
int deserialize (std::istream &in, bool *pitem) throw (SerializationException)
 treat like an int8_t
int deserialize (std::istream &in, float *pitem) throw (SerializationException)
int deserialize (std::istream &in, double *pitem) throw (SerializationException)
int deserialize (std::istream &in, std::string *pitem) throw (SerializationException)
 deserialize by reading first the size, then extracting that number of bytes
template<typename S>
int deserializeStr (const std::string &str, S *pitem)
 deserialize from a string (rather than istream) by using an istringstream
template<typename S>
std::string serialize (const S *pitem)
 serialize an arbitrary item into a string to return by calling either serialize(string&, const S*) or using serializeStr()
template<typename S>
void deserialize (const std::string &s, S *pitem) throw (SerializationException)
 deserialize an object object from a string (rather than istream)
template<typename S>
void serializeMap (std::string &str, const S &s)
 Generic (and now unused) method for serializing a map.
template<typename S>
int deserializeMap (std::istream &in, S &s) throw (SerializationException)
 Generic (and now unused) method for deserializing a map.
template<typename S>
void serializeXML_RPC (std::string &str, const void *pitem, const S &item) throw (SerializationException)
 void* method for serialization, serialize first into a string, then use string serialization
template<typename S>
void serializeXML_RPC (std::string &str, const std::string *pitem, const S &item) throw (SerializationException)
 string serialization in a string tag, encoding entities, or base64 encoding for non-printable characters
template<typename S>
void serializeXML_RPC (std::string &str, const Serializable *pitem, const S &item) throw (SerializationException)
 handle serialization for objects which can serialize themselves
template<typename S>
void serializeXML_RPC (std::string &str, const int *pitem, const S &item)
 4 byte integer serialization using i4
template<typename S>
void serializeXML_RPC (std::string &str, const bool *pitem, const S &item)
 boolean serialization using boolean tag
template<typename S>
void serializeXML_RPC (std::string &str, const double *pitem, const S &item)
 double serialization using double tag
template<typename S>
int deserializeXML_RPC (std::istream &in, void *pitem, S &item) throw (SerializationException)
 void deserialization using string itermediate
template<typename S>
int deserializeXML_RPC (std::istream &in, Serializable *pitem, S &item) throw (SerializationException)
 deserialize objects which know how to deserialize themselves
template<typename S>
int deserializeXML_RPC (std::istream &in, std::string *pitem, S &item) throw (SerializationException)
 handle string deserialization (see serializeXML_RPC(std::istream&, const std::string*, const S&)
template<typename S>
int deserializeXML_RPC (std::istream &in, int *pitem, S &item) throw (SerializationException)
 4 byte integer deserialization using i4 tag or int tag
template<typename S>
int deserializeXML_RPC (std::istream &in, bool *pitem, S &item) throw (SerializationException)
 boolean deserialization using boolean tag
template<typename S>
int deserializeXML_RPC (std::istream &in, double *pitem, S &item) throw (SerializationException)
 double deserialization using double tag
template<typename S>
int deserializeXML_RPCParam (std::istream &in, S *pitem, S &item) throw (SerializationException)
 deserialization for a parameter (param and value tags)
template<typename S>
std::string serializeXML_RPC (const S *pitem, const S &item) throw (SerializationException)
 serialize arbitrary object and return a string
template<typename S>
int deserializeXML_RPCStr (const std::string &str, void *pitem, S &item) throw (SerializationException)
 deserialize an arbitrary object from a string rather than an istream
template<class T, class Key>
void XmlRpcMapSerialize (std::string &str, const T &begin, const T &end) throw (SerializationException)
 generic map serialization
template<class T, class Key, class Data>
int XmlRpcMapDeserialize (std::istream &in, T &obj) throw (SerializationException)
 generic map deserialization
template<class T>
void XmlRpcArraySerialize (std::string &str, const T &begin, const T &end) throw (SerializationException)
 generic array serialization
template<class T, class Key>
int XmlRpcArrayDeserialize (std::istream &in, T &obj) throw (SerializationException)
 generic array deserialization

Variables

const bool PRINT_TYPE_NAMES = false
 tells whether print() methods of mace collections should print the type name, or just the elements.
const int8_t UNDEFINED_ADDRESS = 0
 MaceKey of this type has no sub-type or helper. MaceKey::isNullAddress() would return true.
const int8_t IPV4 = 1
 MaceKey of this type represents an IPV4 address.
const int8_t SHA160 = 2
 MaceKey of this type represents a 160-bit address (generally based on the SHA1 of something).
const int8_t SHA32 = 3
 MaceKey of this type represents a 32-bit address (generally based on the SHA1 of something).
const int8_t STRING_ADDRESS = 4
 MaceKey of this type is a generic string.
const int8_t NUM_ADDRESSES = 5
 The number of MaceKey address families.
const mace::MaceKey::ipv4_type ipv4 = mace::MaceKey::ipv4_type()
 defines an object for passing into the Macekey constructor
const mace::MaceKey::sha160_type sha160 = mace::MaceKey::sha160_type()
 defines an object for passing into the Macekey constructor
const mace::MaceKey::sha32_type sha32 = mace::MaceKey::sha32_type()
 defines an object for passing into the Macekey constructor
const mace::MaceKey::string_type string_key = mace::MaceKey::string_type()
 defines an object for passing into the Macekey constructor


Function Documentation

template<typename S>
std::string mace::convertToString ( const S *  pitem,
const S &  item 
) [inline]

Generic method to convert any object to a string.

Takes a pointer and a reference for historical reasons. These days not technically necessary.

Definition at line 531 of file Printable.h.

Referenced by listToString(), mapToString(), and pointerListToString().

int mace::deserialize ( std::istream &  in,
double *  pitem 
) throw (SerializationException) [inline]

read in 8 bytes

Todo:
modify to do byte-swapping

Definition at line 509 of file Serializable.h.

int mace::deserialize ( std::istream &  in,
float *  pitem 
) throw (SerializationException) [inline]

read in 4 bytes

Todo:
modify to do byte-swapping

Definition at line 499 of file Serializable.h.

MaceKeyDiff mace::operator- ( const MaceKey &  to,
const MaceKey &  from 
) throw (InvalidMaceKeyException)

returns the length between two points on the circle (i.e. between the two ids in id-space).

create a MaceKeyDiff between two MaceKeys

distance can be interpreted either signed or unsigned positive values: 'to' comes after 'from' negative values: 'to' comes before 'from' in absolute terms, the signed distance can be as large as half the circle

NOTE: subtraction defaults to UNSIGNED

Definition at line 125 of file MaceKey.cc.

References ABORT.

void mace::printItem ( std::ostream &  out,
const void *  pitem 
) [inline]

The printItem methods print the item passed in to the ostream.

Various sub-methods exist for all basic types, but also one for a generic Printable object. All others will be caught by this form, which prints a non-printable warning.

Primary use of this method is to support generated code and collections, which try to print things which may in fact not support printing. Calling this method works in all cases, though it prints a warning in some.

Definition at line 184 of file Printable.h.

template<typename S>
void mace::printState ( std::ostream &  out,
const Printable *  pitem,
const S &  item 
) [inline]

Generic method to print any object in its state format.

calls the items printState method.

Definition at line 552 of file Printable.h.

template<typename S>
void mace::printState ( std::ostream &  out,
const void *  pitem,
const S &  item 
) [inline]

Generic method to print any object in its state format.

the void* format of this method just uses printItem. Since it's not printable, printItem is as good as it gets.

Definition at line 543 of file Printable.h.

Referenced by printListState(), and printMapState().

void mace::serialize ( std::string &  str,
const double *  pitem 
) [inline]

serialize a double using append

Todo:
should modify to fix byte ordering

Definition at line 391 of file Serializable.h.

void mace::serialize ( std::string &  str,
const float *  pitem 
) [inline]

serialize a float using append

Todo:
should modify to fix byte ordering

Definition at line 386 of file Serializable.h.

template<typename S>
void mace::serializeXML_RPC ( std::string &  str,
const void *  pitem,
const S &  item 
) throw (SerializationException) [inline]

void* method for serialization, serialize first into a string, then use string serialization

Has both a pointer and reference so it can call serialize from the reference.

Definition at line 76 of file XML_RPCSerialization.h.

References serialize().

Referenced by serializeXML_RPC(), mace::Serializable::serializeXML_RPC(), mace::pair< mace::MaceKey, mace::MaceKey >::serializeXML_RPC(), mace::_SerializeMap< std::string, Data >::serializeXML_RPC(), mace::_SerializeSet< mace::MaceKey >::serializeXML_RPC(), mace::_SerializeArray< uint64_t >::serializeXML_RPC(), XmlRpcArraySerialize(), and XmlRpcMapSerialize().


Generated on Sat Oct 4 21:30:36 2008 for Mace Library by  doxygen 1.5.5