Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Header <boost/asn1/integral.hpp>

Integral data types for ASN1 library.

The integral data types use policy objects to define how to calculate data length and execute the actual encoding and decoding of data.

The basic policy concept is as follows, where T is the integral type the policy is for; bool, int32_t, double.

struct policy
{
  uint32_t calcLength(T v);
  uint32_t encode(ostream& strm, T v, const uint32_t len);
  uint32_t decode(istream& strm, T& v, const uint32_t len);
};

namespace boost {
  namespace asn1 {
    struct policy_boolean;
    struct policy_real;
    struct policy_integer;

    template<typename T, primitives_t P, typename PolicyT> class integral_t;

    typedef integral_t< bool, _boolean, policy_boolean > boolean_t;  // Integral type for the BOOLEAN primitive. 
    typedef shared_ptr< boolean_t > boolean_ptr;  // Pointer type for the BOOLEAN primitive. 
    typedef integral_t< int32_t, _integer, policy_integer > integer_t;  // Integral type for the INTEGER primitive. 
    typedef shared_ptr< integer_t > integer_ptr;  // Pointer type for the INTEGER primitive. 
    typedef integral_t< double, _real, policy_real > real_t;  // Integral type for the REAL primitive. 
    typedef shared_ptr< real_t > real_ptr;  // Pointer type for the REAL primitive. 
    typedef integral_t< int32_t, _enum, policy_integer > enum_t;  // Integral type for the ENUM primitive. 
    typedef shared_ptr< enum_t > enum_ptr;  // Pointer type for the ENUM primitive. 
  }
}
Copyright © 2007 Andreas Haberstroh

PrevUpHomeNext