My favorites | Sign in
Project Home Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/********************************************\
*
* Sire - Molecular Simulation Framework
*
* Copyright (C) 2009 Christopher Woods
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* For full details of the license please see the COPYING file
* that should have come with this distribution.
*
* You can contact the authors via the developer's mailing list
* at http://siremol.org
*
\*********************************************/

#ifndef SIREN_INTERFACE_H
#define SIREN_INTERFACE_H

#include <QStringList>

#include "sirenglobal.h"

SIREN_BEGIN_HEADER

namespace Siren
{

/** This is the base class of all interfaces. Interfaces
are pure virtual base classes that provide the only
means by which multiple inheritance may be used
with Siren::Objects. An Interface is very similar
to an Interface in Java

@author Christopher Woods
*/
class SIREN_EXPORT Interface
{
public:
Interface();

virtual ~Interface();

protected:
static bool IS_INTERFACE()
{
return true;
}
};

namespace detail
{

class NONE_BASE
{
protected:
static bool IS_INTERFACE()
{
return false;
}

static QString typeName()
{
return QString::null;
}
};

class NONE_1 : public NONE_BASE {};
class NONE_2 : public NONE_BASE {};
class NONE_3 : public NONE_BASE {};
class NONE_4 : public NONE_BASE {};
class NONE_5 : public NONE_BASE {};
class NONE_6 : public NONE_BASE {};
class NONE_7 : public NONE_BASE {};

}

/** Use this class to provide the list of interfaces that an
object or handle inherits, e.g.

class MyObject : public Implements<MyObject,Object>,
public Interfaces<MyInterface,MyOtherInterface>

class MyHandle : public Handles<MyHandle,HandleData>,
public Interfaces<MyInterface,MyOtherInterface>

@author Christopher Woods
*/
template<class Derived,
class I0, class I1=detail::NONE_1,
class I2=detail::NONE_2, class I3=detail::NONE_3,
class I4=detail::NONE_4, class I5=detail::NONE_5,
class I6=detail::NONE_6, class I7=detail::NONE_7>
class SIREN_EXPORT Interfaces
: public virtual I0, public virtual I1,
public virtual I2, public virtual I3,
public virtual I4, public virtual I5,
public virtual I6, public virtual I7
{
public:
Interfaces() : I0(), I1(), I2(), I3(),
I4(), I5(), I6(), I7()
{}

~Interfaces()
{}

static QString typeName()
{
return Derived::typeName();
}

protected:
static bool IS_INTERFACE()
{
return false;
}

static QStringList listInterfaces()
{
QStringList ifaces;

if (I0::IS_INTERFACE())
ifaces.append( I0::typeName() );

if (I1::IS_INTERFACE())
ifaces.append( I0::typeName() );

if (I2::IS_INTERFACE())
ifaces.append( I0::typeName() );

if (I3::IS_INTERFACE())
ifaces.append( I0::typeName() );

if (I4::IS_INTERFACE())
ifaces.append( I0::typeName() );

if (I5::IS_INTERFACE())
ifaces.append( I0::typeName() );

if (I6::IS_INTERFACE())
ifaces.append( I0::typeName() );

if (I7::IS_INTERFACE())
ifaces.append( I0::typeName() );

return ifaces;
}
};

}

SIREN_END_HEADER

#endif

Change log

r1102 by chryswoods on Nov 20, 2009   Diff
I've got Siren compiled and linked, and
have got (most) of the python wrappers
working.
The code works, to an extent, but there
are quite a few problems and bugs
(e.g. in streaming, and in the logger).
The whole .getClass() hierarchy
works really well :-)

Code is no longer broken - it compiles,
links and Siren now needs debugging

Go to: 
Sign in to write a code review

Older revisions

r1093 by chryswoods on Nov 15, 2009   Diff
I've created the Handle hierarchy of
classes which are used to provide the
equivalent
of Object for shared data types.
Handle provides handles with which to
...
r1092 by chryswoods on Nov 14, 2009   Diff
I've finished the basics of Siren -
all the code compiles, but there are
lots of unresolved symbols.

Siren is very broken
...
r1088 by chryswoods on Nov 13, 2009   Diff
I'm committing my work to date to
abstract the various Sire object
systems into
a single consistent (Java-like)
hierarchy, called Siren. Once this is
...
All revisions of this file

File info

Size: 4133 bytes, 167 lines
Powered by Google Project Hosting