XdmfObject.hpp 852 Bytes
Newer Older
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
 * XdmfObject.hpp
 *
 *  Created on: Feb 1, 2010
 *      Author: kleiter
 */

#ifndef XDMFOBJECT_HPP_
#define XDMFOBJECT_HPP_

#include "boost/shared_ptr.hpp"
#include <iostream>
#include <ostream>

#define XdmfNewMacro(type) \
template <typename T> friend void boost::checked_delete(T * x); \
static boost::shared_ptr<type> New() \
{ \
	boost::shared_ptr<type> p(new type()); \
	return p; \
}

23
#define XdmfGetValueMacro(var, type) \
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
24 25 26 27 28 29
type get##var () \
{ \
  return ( this->m##var ); \
}

#define XdmfSetValueMacro(var,type) \
30
void set##var (const type _arg) \
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
31 32 33 34 35 36 37 38 39
{ \
  this->m##var = _arg; \
}

class XdmfObject {

public:

	XdmfNewMacro(XdmfObject);
40
	virtual const std::string printSelf() const;
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
41 42 43 44 45 46 47 48 49 50 51

protected:

	XdmfObject();
	virtual ~XdmfObject();

};

std::ostream& operator<<(std::ostream& out, const XdmfObject& ob);

#endif /* XDMFOBJECT_HPP_ */