/usr/include/magics/MagicsEvent.h is in libmagics++-dev 2.22.7.dfsg.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | /*! \file MagicsEvent.h
\brief Definition of the Template class MagicsEvent.
Magics Team - ECMWF 2007
Started: Thu 22-Nov-2007
Changes:
*/
#ifndef MagicsEvent_H
#define MagicsEvent_H
#include "magics.h"
#include "MagicsObserver.h"
namespace magics {
class Layer;
class MetaDataCollector;
class DateTime;
class MagicsEvent
{
public:
MagicsEvent() {}
virtual ~MagicsEvent() {}
virtual void notify(MagicsObserver& ) {}
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
virtual void print(ostream& out) const { out << "MagicsEvent[]"; }
private:
//! Copy constructor - No copy allowed
MagicsEvent(const MagicsEvent&);
//! Overloaded << operator to copy - No copy allowed
MagicsEvent& operator=(const MagicsEvent&);
// -- Friends
//! Overloaded << operator to call print().
friend ostream& operator<<(ostream& s,const MagicsEvent& p)
{ p.print(s); return s; }
};
class MagicsCursorEvent : public MagicsEvent
{
public:
MagicsCursorEvent(const string& cursor = "") : cursor_(cursor) {}
virtual ~MagicsCursorEvent() {}
virtual void notify(MagicsObserver& observer) { observer.notify(*this); }
const string& cursor() { return cursor_; }
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
virtual void print(ostream& out) const { out << "MagicsCursorEvent[cursor : " << cursor_ << "]"; }
string cursor_;
};
class MagicsSwapBufferEvent : public MagicsEvent
{
public:
MagicsSwapBufferEvent() {}
virtual ~MagicsSwapBufferEvent() {}
virtual void notify(MagicsObserver& observer) { observer.notify(*this); }
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
virtual void print(ostream& out) const { out << "MagicsSwapBufferEvent[]"; }
};
class MagicsAntialiasingEvent: public MagicsEvent
{
// From Uplot to driver!
public:
MagicsAntialiasingEvent(bool set) : set_(set) {}
virtual ~MagicsAntialiasingEvent() {}
virtual void notify(MagicsObserver& observer) { observer.notify(*this); }
bool set() const { return set_; }
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
virtual void print(ostream& out) const {
string set = ( set_ ) ? "on" : "false";
out << "MagicsAntialiasingEvent[" << set << "]";
}
bool set_;
};
class MagicsZoomEvent: public MagicsEvent
{
// From Uplot to driver!
public:
MagicsZoomEvent(bool set) : set_(set) {}
virtual ~MagicsZoomEvent() {}
void notify(MagicsObserver& observer) { observer.notify(*this); }
bool set() const { return set_; }
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
virtual void print(ostream& out) const {
string set = ( set_ ) ? "on" : "false";
out << "MagicsZoomEvent[" << set << "]";
}
bool set_;
};
class MagicsMagnifierEvent: public MagicsEvent
{
// From Uplot to driver!
public:
MagicsMagnifierEvent(bool set) : set_(set) {}
virtual ~MagicsMagnifierEvent() {}
void notify(MagicsObserver& observer) { observer.notify(*this); }
bool set() const { return set_; }
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
virtual void print(ostream& out) const {
string set = ( set_ ) ? "on" : "false";
out << "MagicsMagnifierEvent[" << set << "]";
}
bool set_;
};
class MagicsRestoreFbEvent: public MagicsEvent
{
// From Uplot to driver!
public:
MagicsRestoreFbEvent() {}
virtual ~MagicsRestoreFbEvent() {}
void notify(MagicsObserver& observer) { observer.notify(*this); }
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
virtual void print(ostream& out) const {
out << "MagicsRestoreFbEvent[" << "]"; }
};
class MagicsAnimationStepData
{
public:
MagicsAnimationStepData(vector<string>& label, bool /*cached*/) : label_(label), cached_(false) {};
const vector<string>& label() const {return label_;}
bool cached() const {return cached_;}
void setLabel(vector<string>& s) {label_=s;}
void setCached(bool b) {cached_=b;}
private:
vector<string> label_;
bool cached_;
};
class MagicsAnimationCurrentStepEvent: public MagicsEvent
{
// From Uplot to driver!
public:
MagicsAnimationCurrentStepEvent(int step) : step_(step) {}
virtual ~MagicsAnimationCurrentStepEvent() {}
void notify(MagicsObserver& observer) { observer.notify(*this); }
int step() const { return step_; }
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
virtual void print(ostream& out) const {
out << "MagicsAnimationCurrentStepEvent[" << step_ << "]"; }
int step_;
};
class MagicsAnimationStepsEvent: public MagicsEvent
{
// From Uplot to driver!
public:
MagicsAnimationStepsEvent(vector<MagicsAnimationStepData> steps) : steps_(steps) {}
virtual ~MagicsAnimationStepsEvent() {}
void notify(MagicsObserver& observer) { observer.notify(*this); }
const vector<MagicsAnimationStepData>& steps() const { return steps_; }
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
virtual void print(ostream& out) const {
out << "MagicsAnimationFramseEvent[" << "]"; }
vector<MagicsAnimationStepData> steps_;
};
class MagicsLayerUpdateEvent: public MagicsEvent
{
// From Uplot to driver!
public:
MagicsLayerUpdateEvent() {}
virtual ~MagicsLayerUpdateEvent() {}
void notify(MagicsObserver& observer) { observer.notify(*this); }
protected:
//! Method to print string about this class on to a stream of type ostream (virtual).
virtual void print(ostream& out) const {
out << "MagicsLayerUpdateEvent[" << "]"; }
};
class LevelDescription
{
public:
LevelDescription();
~LevelDescription();
static LevelDescription surface(int set, int index) {
LevelDescription level;
level.surface_ = true;
level.index_ = index;
level.set_ = set;
return level;
}
static LevelDescription level(const string& unit, double l, int set, int index) {
LevelDescription newlevel;
newlevel.surface_ = false;
newlevel.unit_ = unit;
newlevel.level_ = l;
newlevel.set_ = set;
newlevel.index_ = index;
return newlevel;
}
bool operator < (const LevelDescription& other) const; // Code function in Layer.cc
void update(const LevelDescription&) const;
protected:
bool surface_;
string unit_;
double level_;
mutable int set_;
mutable int index_;
};
class DateDescription
{
public:
DateDescription() {}
DateDescription(const string& valid, int set, int index) : valid_(valid), set_(set), index_(index) {}
~DateDescription();
void update(const DateDescription&) const;
bool operator < (const DateDescription& other) const; // Code function in Layer.cc
protected:
string valid_;
mutable int set_;
mutable int index_;
};
struct MetviewIcon
{
public:
MetviewIcon(const string& name = "", const string& cname = "", const string& id="unknown") :
iconName_(name), iconClass_(cname), iconId_(id) {};
void icon(const string& name, const string& cname, const string& id="unknown") {
iconName_ = name;
iconClass_ = cname;
iconId_ = id;
}
virtual void visit(Layer& layer);
virtual void visit(MetaDataCollector& collector);
virtual void initInfo() {}
string info(const string& name) {return (information_.find(name) != information_.end())?information_[name]:"";}
void setInfo(const string& name, const string& value) { information_[name]=value; }
void icon(const MetviewIcon& other) {
iconName_ = other.iconName_;
iconClass_ = other.iconClass_;
iconId_ = other.iconId_;
}
string iconName() const {return iconName_;}
string iconClass() const {return iconClass_;}
string iconId() const {return iconId_;}
protected:
string iconName_;
string iconClass_;
string iconId_;
map<string, string> information_;
};
} // namespace magics
#endif
|