|
Boost-Commit : |
From: chintanraoh_at_[hidden]
Date: 2008-07-03 14:01:56
Author: chintanraoh
Date: 2008-07-03 14:01:55 EDT (Thu, 03 Jul 2008)
New Revision: 47047
URL: http://svn.boost.org/trac/boost/changeset/47047
Log:
documented pat_key_traits
Text files modified:
sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/pat_key_traits.hpp | 34 ++++++++++++++++++++++++++++++----
1 files changed, 30 insertions(+), 4 deletions(-)
Modified: sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/pat_key_traits.hpp
==============================================================================
--- sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/pat_key_traits.hpp (original)
+++ sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/pat_key_traits.hpp 2008-07-03 14:01:55 EDT (Thu, 03 Jul 2008)
@@ -7,31 +7,57 @@
namespace dsearch{
-//because we require an unsigned type from each element
+///key traits describing extra traits required for patricia.
class pat_key_traits{
public:
- typedef unsigned char element_type; //element type = unsigned type with size 2^(8*2^n) upto n=3. ie "unsigned long long";
+ /// element type = unsigned type. \n
+ /// each element in string (ie char) should correspond to element_type.
+ /// ie unsigned char.
+ typedef unsigned char element_type ;
+ /// Const_iterator used by patricia to iterate through elements.
+ /// It can be forward or random access.
typedef std::string::const_iterator const_iterator ;
-
+
+ /// Returns the begin iterator of a key.
+ /**
+ \returns const_iterator positioned at begining of the string.
+ \param key whose begin is to found
+ */
static inline const_iterator begin (std::string const &key)
{
return key.begin();
}
+ /// Returns the end of a key.
+ /**
+ \returns const_iterator positioned at the end.
+ \param key whose end is to found
+ */
static inline const_iterator end (std::string const &key)
{
return key.end();
}
+ /// Returns the size of the key.
+ /**
+ \returns size of the key.
+ \param key whose size is to found
+ */
static inline std::size_t size(std::string const &key)
{
return key.size();
}
+
+ /// Deference iterator to corresponding element_type , ie unsigned type.
+ /**
+ \returns unsigned integer of element_type corresponding to the iterator.
+ \param it: iterator corresponding to which element_type if to be found
+ */
static inline element_type get_element(const const_iterator &it)
{
return static_cast<unsigned char>(*it);
}
- //no get_key as the keys are stored as it is.
+
};
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk