14 #ifndef __INCLUDED_SCOPIRA_CORE_MODEL_H__ 15 #define __INCLUDED_SCOPIRA_CORE_MODEL_H__ 22 #include <scopira/tool/object.h> 23 #include <scopira/tool/reactor.h> 24 #include <scopira/tool/iterator.h> 25 #include <scopira/tool/export.h> 88 : dm_ins(ins), dm_ptr(0) { assert(ins); }
108 dm_ptr->remove_view(dm_ins);
120 {
set(o);
return *
this; }
128 {
set(o.
dm_ptr);
return *
this; }
135 {
return dm_ptr == rhs.
dm_ptr; }
142 {
return dm_ptr != rhs.
dm_ptr; }
148 bool operator < (const model_ptr<T> &rhs)
const 149 {
return dm_ptr < rhs.dm_ptr; }
177 { assert(dm_ptr);
return *dm_ptr; }
186 T* operator ->(
void)
const 187 { assert(dm_ptr);
return dm_ptr; }
196 T & operator *(
void)
const 197 { assert(dm_ptr);
return *dm_ptr; }
204 bool is_null(
void)
const {
return dm_ptr == 0; }
219 typedef std::vector<view_i*> view_list;
220 typedef std::vector<scopira::tool::rename_reactor_i*> rename_list;
221 typedef std::map<std::string, scopira::tool::count_ptr<model_i> > archive_cache_t;
223 mutable view_list dm_views;
224 mutable rename_list dm_rename_reactors;
225 std::string dm_title;
229 archive_cache_t dm_archive_cache;
244 SCOPIRA_EXPORT
virtual void set_title(
const std::string &newtitle);
257 const std::string &
get_title(
void)
const {
return dm_title; }
265 SCOPIRA_EXPORT
void add_view(
view_i *ins)
const;
271 SCOPIRA_EXPORT
void remove_view(
view_i *ins)
const;
280 SCOPIRA_EXPORT
void notify_views(
view_i *src);
301 SCOPIRA_EXPORT
virtual void set_project(
project_i *newowner);
315 SCOPIRA_EXPORT
void set_tagged_model(
const std::string &name,
model_i *what);
327 typedef typename W::data_type data_type;
329 if (!get_tagged_model_impl(name, mm))
331 out =
dynamic_cast<data_type*
>(mm.
get());
332 return mm.
is_null() || out.get();
339 SCOPIRA_EXPORT model_i(
const std::string &title);
341 SCOPIRA_EXPORT model_i(
const model_i &src);
343 SCOPIRA_EXPORT
virtual ~model_i();
347 SCOPIRA_EXPORT
bool get_tagged_model_impl(
const std::string &name,
model_ptr(view_i *ins)
Definition: model.h:87
Definition: archiveflow.h:20
scopira::tool::iterator_g< model_i * > model_iterator
the model iterator type
Definition: model.h:38
project_i * get_project(void) const
Definition: model.h:308
model_i * dm_model
internal: the actual pointer
Definition: model.h:54
~model_ptr()
Definition: model.h:93
T & ref(void) const
Definition: model.h:176
view_i * dm_ins
the view
Definition: model.h:77
model_ptr_base(void)
ctor
Definition: model.h:57
T data_type
the type of the data this model_ptr points too
Definition: model.h:73
model_i *const & get_model_ptr(void) const
gets the raw base pointer (really specialized use here)
Definition: model.h:61
T * dm_ptr
the actual pointer
Definition: model.h:79
virtual bool is_project(void) const
Definition: model.h:251
bool is_null(void) const
Definition: model.h:204
bool get_tagged_model(const std::string &name, W &out)
Definition: model.h:326
const std::string & get_title(void) const
Definition: model.h:257