File: reaction-prop.h

package info (click to toggle)
gnome-chemistry-utils 0.14.9-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 17,836 kB
  • ctags: 7,337
  • sloc: cpp: 72,977; sh: 11,381; xml: 6,304; makefile: 1,663; ansic: 1,061
file content (170 lines) | stat: -rw-r--r-- 3,805 bytes parent folder | download
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
168
169
170
// -*- C++ -*-

/*
 * GChemPaint library
 * reaction-prop.h
 *
 * Copyright (C) 2007-2010 Jean Bréfort <jean.brefort@normalesup.org>
 *
 * 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 3 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
 * USA
 */

#ifndef GCHEMPAINT_REACTION_PROP_H
#define GCHEMPAINT_REACTION_PROP_H

#include <gcu/object.h>
#include <gcu/dialog-owner.h>
#include <gcu/macros.h>

/*!\file*/
namespace gcp {

extern gcu::TypeId ReactionPropType;
class ReactionArrow;

/*!
This enumerates the known roles of objects attached to a reaction arrow
*/
enum {
/*!
Unkonw role.
*/
	REACTION_PROP_UNKNOWN,
/*!
Catalyst
*/
	REACTION_PROP_CATALYST,
/*!
Reactant
*/
	REACTION_PROP_REACTANT,
/*!
Product
*/
	REACTION_PROP_PRODUCT,
/*!
Solvent
*/
	REACTION_PROP_SOLVENT,
/*!
Values allowed for molecules are lower than this one
*/
	REACTION_PROP_MAX_MOL,
/*!
Temperature
*/
	REACTION_PROP_TEMPERATURE = REACTION_PROP_MAX_MOL,
/*!
Pressure
*/
	REACTION_PROP_PRESSURE,
/*!
Reaction time.
*/
	REACTION_PROP_TIME,
/*!
Reaction enthalpy
*/
	REACTION_PROP_ENTHALPY,
/*!
The first value greater than all knwo values.
*/
	REACTION_PROP_MAX,
};

/*!
The names associated with the various roles knwon for objects attached to
reaction arrows. These names are used for serialization.
*/
extern char const *ReactionPropRoles[];

/*!\class ReactionProp gcp/reaction-prop.h
This is a container class for objects attached to a reaction arrow.
*/

class ReactionProp: public gcu::Object, public gcu::DialogOwner
{
public:
/*!
The default constructor.
*/
	ReactionProp ();
/*!
@param parent the parent reaction arrow.
@param child the molecule or text to attach to the arrow.

Builds a new reactionproperty, and attach the child to the arrow.
*/
	ReactionProp (ReactionArrow *parent, gcu::Object *child);
/*!
The destructor.
*/
	~ReactionProp ();

/*!
@param xml the xmlDoc used to save the document.

Used to save the reaction property to the xmlDoc.
@return the xmlNode containing the serialized reaction property.
*/
	xmlNodePtr Save (xmlDocPtr xml);
/*!
@param node: a pointer to the xmlNode containing the serialized reaction property.

Used to load a reaction property in memory.
@return true on succes, false otherwise.
*/
	bool Load (xmlNodePtr node);
/*!
@param Signal the appropriate SignalId
@param Child the child which emitted the signal or NULL

This function is called by the framework when a signal has been emitted for
the reaction property, when one its emedded object changed.
It should not be called by a program; call Object::EmitSignal instead.

@return true to be propagate the signal to the parent.
*/
	bool OnSignal (gcu::SignalId Signal, gcu::Object *Child);

/*!
@return the localized object generic name.
*/
	std::string Name ();

private:
/*!\fn GetObject()
@return the embedded object.
*/
GCU_RO_PROP (gcu::Object*, Object);
/*!\fn SetRole(unsigned Role)
@param Role the new role for the property.

Sets the role for the property which should be less than REACTION_PROP_MAX.
*/
/*!\fn GetRole()
@return the property role.
*/
/*!\fn GetRefRole()
@return the property role as a reference.
*/
GCU_PROP (unsigned, Role);
};

}	//	namespace gcp


#endif	//	GCHEMPAINT_REACTION_PROP_H