summaryrefslogtreecommitdiffabout
path: root/include/sitecing/component_so.h
Side-by-side diff
Diffstat (limited to 'include/sitecing/component_so.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/sitecing/component_so.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/sitecing/component_so.h b/include/sitecing/component_so.h
index 3239d4a..3daceef 100644
--- a/include/sitecing/component_so.h
+++ b/include/sitecing/component_so.h
@@ -56,104 +56,110 @@ namespace sitecing {
used_chickens_t chickens_used;
/**
* The list of unused instances.
*/
free_chickens_t chickens_free;
/**
* @param soname the .so file name
*/
component_so(const string& soname);
~component_so();
/**
* Check whether the loaded .so is in sync with the disk file.
*/
bool is_uptodate() const;
/**
* @todo TODO: wish I could remember -- document me.
*/
acomponent* allocate_chicken();
/**
* @todo TODO: wish I could remember -- document me.
*/
void allocate_chicken(acomponent *ac);
/**
* @todo TODO: wish I could remember -- document me.
*/
void deallocate_chicken(acomponent *ac);
};
/**
* The component instance container.
*/
class so_component {
public:
/**
* Pointer to the component 'class'.
*/
component_so *hen;
/**
* The instance in question.
*/
acomponent* ac;
so_component()
: hen(0), ac(0) { }
/**
* @param h the 'class' object.
* @param scif pointer to the interface to the site-C-ing core.
*/
so_component(component_so *h,sitecing_interface *scif);
/**
* Copy constructor
* @param s source instance.
*/
so_component(const so_component& s)
: hen(0), ac(0) { attach(s); }
~so_component() { detach(); }
/**
* Assignment operator.
* @param s source instance.
*/
so_component& operator=(const so_component& s) {
attach(s); return *this;
}
/**
* @todo TODO: wish I could remember the details -- document me.
* @param h the 'class' object.
* @param a the instance to be attached.
*/
void attach(component_so *h,acomponent *a);
/**
* @todo TODO: wish I could remember the details -- document me.
* @param s the source instance.
*/
void attach(const so_component& s) { attach(s.hen,s.ac); }
/**
* @todo TODO: wish I could remember the details -- document me.
*/
void detach();
};
/**
* The typed component instance container template.
* @param CT the component class.
*/
template<typename CT>
class so_component_t : public sitecing::so_component {
public:
/**
* @param s The untyped instance container.
*/
so_component_t(const so_component& s)
: so_component(s) { }
+
+ /**
+ * typed dereference operator
+ * @return the pointer to the most derived component instance
+ * @see acomponent::__the_most_derived_this()
+ */
CT* operator->() {
return static_cast<CT*>(ac->__the_most_derived_this());
}
};
}
#endif /* __SITECING_COMPONENT_SO_H */