Added the parts of boost which we need to access shared_ptr and weak_ptr. This will allow for improved memory management of large volumes.

This commit is contained in:
David Williams
2009-03-29 22:07:27 +00:00
parent 69751dc084
commit d574a18ce3
163 changed files with 18689 additions and 32 deletions

View File

@ -0,0 +1,61 @@
//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc.
//Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef UUID_CE6983AC753411DDA764247956D89593
#define UUID_CE6983AC753411DDA764247956D89593
#include <string>
namespace
boost
{
namespace
exception_detail
{
class
error_info_base
{
public:
virtual char const * tag_typeid_name() const = 0;
virtual std::string value_as_string() const = 0;
protected:
virtual
~error_info_base() throw()
{
}
};
}
template <class Tag,class T>
class
error_info:
public exception_detail::error_info_base
{
public:
typedef T value_type;
error_info( value_type const & value );
~error_info() throw();
value_type const &
value() const
{
return value_;
}
private:
char const * tag_typeid_name() const;
std::string value_as_string() const;
value_type const value_;
};
}
#endif

View File

@ -0,0 +1,38 @@
//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc.
//Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef UUID_898984B4076411DD973EDFA055D89593
#define UUID_898984B4076411DD973EDFA055D89593
#include <ostream>
namespace
boost
{
namespace
to_string_detail
{
template <class T,class CharT,class Traits>
char operator<<( std::basic_ostream<CharT,Traits> &, T const & );
template <class T,class CharT,class Traits>
struct
is_output_streamable_impl
{
static std::basic_ostream<CharT,Traits> & f();
static T const & g();
enum e { value=1!=(sizeof(f()<<g())) };
};
}
template <class T, class CharT=char, class Traits=std::char_traits<CharT> >
struct
is_output_streamable
{
enum e { value=to_string_detail::is_output_streamable_impl<T,CharT,Traits>::value };
};
}
#endif

View File

@ -0,0 +1,40 @@
//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc.
//Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef UUID_6F463AC838DF11DDA3E6909F56D89593
#define UUID_6F463AC838DF11DDA3E6909F56D89593
#include <boost/exception/detail/type_info.hpp>
#include <iomanip>
#include <ios>
#include <string>
#include <sstream>
namespace
boost
{
namespace
exception_detail
{
template <class T>
inline
std::string
object_hex_dump( T const & x, size_t max_size=16 )
{
std::ostringstream s;
s << "type: " << type_name<T>() << ", size: " << sizeof(T) << ", dump: ";
size_t n=sizeof(T)>max_size?max_size:sizeof(T);
s.fill('0');
s.width(2);
unsigned char const * b=reinterpret_cast<unsigned char const *>(&x);
s << std::setw(2) << std::hex << (unsigned int)*b;
for( unsigned char const * e=b+n; ++b!=e; )
s << " " << std::setw(2) << std::hex << (unsigned int)*b;
return s.str();
}
}
}
#endif

View File

@ -0,0 +1,130 @@
//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc.
//Distributed under the Boost Software License, Version 1.0. (See accompanying
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef UUID_C3E1741C754311DDB2834CCA55D89593
#define UUID_C3E1741C754311DDB2834CCA55D89593
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/current_function.hpp>
namespace
boost
{
template <class T>
inline
char const *
tag_type_name()
{
#ifdef BOOST_NO_TYPEID
return BOOST_CURRENT_FUNCTION;
#else
return typeid(T*).name();
#endif
}
template <class T>
inline
char const *
type_name()
{
#ifdef BOOST_NO_TYPEID
return BOOST_CURRENT_FUNCTION;
#else
return typeid(T).name();
#endif
}
namespace
exception_detail
{
#ifdef BOOST_NO_TYPEID
struct
type_info_
{
detail::sp_typeinfo type_;
char const * name_;
explicit
type_info_( detail::sp_typeinfo type, char const * name ):
type_(type),
name_(name)
{
}
friend
bool
operator==( type_info_ const & a, type_info_ const & b )
{
return a.type_==b.type_;
}
friend
bool
operator<( type_info_ const & a, type_info_ const & b )
{
return a.type_<b.type_;
}
char const *
name() const
{
return name_;
}
};
#else
struct
type_info_
{
detail::sp_typeinfo const * type_;
explicit
type_info_( detail::sp_typeinfo const & type ):
type_(&type)
{
}
type_info_( detail::sp_typeinfo const & type, char const * ):
type_(&type)
{
}
friend
bool
operator==( type_info_ const & a, type_info_ const & b )
{
return (*a.type_)==(*b.type_);
}
friend
bool
operator<( type_info_ const & a, type_info_ const & b )
{
return 0!=(a.type_->before(*b.type_));
}
char const *
name() const
{
return type_->name();
}
};
#endif
inline
bool
operator!=( type_info_ const & a, type_info_ const & b )
{
return !(a==b);
}
}
}
#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T),::boost::tag_type_name<T>())
#ifndef BOOST_NO_RTTI
#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x))
#endif
#endif