summaryrefslogtreecommitdiff
path: root/cad/plugins/NanoVision-1/include/Nanorex/Interface/NXDataStoreInfo.h
blob: 82f80da8b5fc36ff3eecaa7fa0865402a10a8500 (plain)
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
// Copyright 2008 Nanorex, Inc.  See LICENSE file for details.

#ifndef NX_DATASTOREINFO_H
#define NX_DATASTOREINFO_H

#include <vector>
#include <map>
#include <string>
using namespace std;

#include "Nanorex/Interface/NXNamedView.h"
#include "Nanorex/Interface/NXMoleculeSet.h"
#include "Nanorex/Utility/NXProperties.h"

namespace Nanorex {


/* CLASS: NXDataStoreInfo */
/**
 * Fill this out.
 *
 * @ingroup NanorexInterface PluginArchitecture
 */
class NXDataStoreInfo {
public:
	NXDataStoreInfo();
	~NXDataStoreInfo();
		//
		// Single structures
		//
	bool isSingleStructure();
	void setIsSingleStructure(bool _isSingleStructure);
	
	const string& getSingleStructureFileName();
	int getSingleStructureId();
	
		//
		// Simulation results
		//
	bool isSimulationResults();
	void setIsSimulationResults(bool _isSimulationResults);
	
	NXProperties* getInputParameters();
	void setInputParameters(NXProperties* parameters);
	
	vector<string> getInputFileNames();
	void addInputStructure(const string& fileName);
	int getInputStructureId(const string& fileName);
	void setInputStructureId(const string& fileName, int frameSetId);
	
	NXProperties* getResultsSummary();
	void setResultsSummary(NXProperties* resultsSummary);
	
	vector<string> getTrajectoryNames();
	void addTrajectory(const string& name, int frameSetId);
	int getTrajectoryId(const string& name);
	
	void setLastFrame(int frameSetId, bool isLastFrame);
	bool isLastFrame(int frameSetId);
	
	bool storeIsComplete(int frameSetId);
	void setStoreComplete(int frameSetId, bool storeIsComplete);
	
	
	//
	// General
	//
	// Data store file names
	const string& getFileName(int frameSetId);
	void setFileName(const string& fileName, int frameSetId);
	
	// Data store file handles
	void setHandle(int frameSetId, void* handle);
	void* getHandle(int frameSetId);
	
	//
	// Clipboard
	//
	
	bool hasClipboardStructure(void) const;
	NXMoleculeSet *const getClipboardStructure(void) const;
	void setClipboardStructure(NXMoleculeSet *const molSetPtr);
	
	// Named-views
	bool hasHomeView(void) const;
	NXNamedView const& getHomeView(void) const;
	void setHomeView(NXNamedView const& theHomeView);
	
	bool hasLastView(void) const;
	NXNamedView const& getLastView(void) const;
	void setLastView(NXNamedView const& theLastView);
	
	vector<NXNamedView> const& getOtherViews(void) const;
	void addOtherView(NXNamedView const& view);
	
	void reset(void);
	
private:
	bool _isSimulationResults, _isSingleStructure;
	NXProperties* _inputParameters, *_resultsSummary;
	
	// Maps frame set id to its source file name.
	map<int, string> _fileNames;
	
	// Maps input structure name to its frame set id.
	map<string, int> _inputStructures;
	
	// Maps trajectory name to its frame set id.
	map<string, int> _trajectories;
	
	// Maps frame set id to its file handle.
	map<int, void*> _handle;
	
	// Maps frame set id to its last-frame status
	map<int, bool> _isLastFrame;
	
	// Maps frame set id to its store-complete status
	map<int, bool> _storeIsComplete;
	
	NXMoleculeSet* _clipboardStructure;
	
	// Named-views
	Nanorex::NXNamedView homeView;
	Nanorex::NXNamedView lastView;
	vector<Nanorex::NXNamedView> otherViews;	
};


/* FUNCTION: hasClipboardStructures */
inline
	bool NXDataStoreInfo::hasClipboardStructure(void) const
{
	return (_clipboardStructure != NULL);
}


/* FUNCTION: getClipboardStructures */
inline
	NXMoleculeSet *const NXDataStoreInfo::getClipboardStructure(void) const
{
	return _clipboardStructure;
}


/* FUNCTION: addClipboardStructure */
inline
	void NXDataStoreInfo::setClipboardStructure(NXMoleculeSet*const molSetPtr)
{
	_clipboardStructure = molSetPtr;
}


inline bool NXDataStoreInfo::hasHomeView(void) const
{
	bool const result = (homeView.getName() == "HomeView");
	return result;
}


inline Nanorex::NXNamedView const& NXDataStoreInfo::getHomeView(void) const
{
	return homeView;
}


inline void NXDataStoreInfo::setHomeView(Nanorex::NXNamedView const& theHomeView)
{
	homeView = theHomeView;
}


inline bool NXDataStoreInfo::hasLastView(void) const
{
	bool result = (lastView.getName() == "LastView");
	return result;
}


inline Nanorex::NXNamedView const& NXDataStoreInfo::getLastView(void) const
{
	return lastView;
}


inline
void NXDataStoreInfo::setLastView(Nanorex::NXNamedView const& theLastView)
{
	lastView = theLastView;
}


inline
vector<Nanorex::NXNamedView> const& NXDataStoreInfo::getOtherViews(void) const
{
	return otherViews;
}


inline
void NXDataStoreInfo::addOtherView(Nanorex::NXNamedView const& view)
{
	otherViews.push_back(view);
}


} // Nanorex::

#endif