1 // -*- C++ -*-
2 // AsapObject.cpp: Provides a name and __repr__ for all Python objects.
3 //
4 // AsapObject should be a base class for all C++ classes that will
5 // have a life as Python object, to support among others the __repr__
6 // method.
7 //
8 // Copyright (C) 2008 Jakob Schiotz and Center for Individual
9 // Nanoparticle Functionality, Department of Physics, Technical
10 // University of Denmark.  Email: schiotz@fysik.dtu.dk
11 //
12 // This file is part of Asap version 3.
13 // Asap is released under the GNU Lesser Public License (LGPL) version 3.
14 // However, the parts of Asap distributed within the OpenKIM project
15 // (including this file) are also released under the Common Development
16 // and Distribution License (CDDL) version 1.0.
17 //
18 // This program is free software: you can redistribute it and/or
19 // modify it under the terms of the GNU Lesser General Public License
20 // version 3 as published by the Free Software Foundation.  Permission
21 // to use other versions of the GNU Lesser General Public License may
22 // granted by Jakob Schiotz or the head of department of the
23 // Department of Physics, Technical University of Denmark, as
24 // described in section 14 of the GNU General Public License.
25 //
26 // This program is distributed in the hope that it will be useful,
27 // but WITHOUT ANY WARRANTY; without even the implied warranty of
28 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29 // GNU General Public License for more details.
30 //
31 // You should have received a copy of the GNU General Public License
32 // and the GNU Lesser Public License along with this program.  If not,
33 // see <http://www.gnu.org/licenses/>.
34 
35 #include "Asap.h"
36 #include "AsapObject.h"
37 #include <stdio.h>
38 
GetRepresentation() const39 string AsapObject::GetRepresentation() const
40 {
41   char buffer[50];
42   sprintf(buffer, "0x%p", this);
43   return "<asap." + GetName() + " object at " + buffer + ">";
44 }
45