C++ does not offer the same interface facility as Java or C#. Instead it relies on multiple inheritance, which can be tricky and sometimes breaks polymorphism.
To prevent that, libcrn defines protocols, inspired by Objective-C's formal and informal protocols. Any class may or may not implement each protocol. The list of implemented protocols can be retrieved by calling the GetClassProtocols() method on any object. The implementation of a specific protocol can be checked with the method bool Implements(unsigned int protocol). Calling a method that is part of an unimplemented protocol causes a exception to be thrown. All protocols are listed in the crn::protocols namespace.
The object can be duplicated by calling CRNObject Clone () const.
The object can be added to an XML tree with crn::xml::Element Serialize(crn::xml::Element &parent) const or loaded from it with void Deserialize(crn::xml::Element &el).
A distance is defined between two objects of the same class: double Distance(const crn::Object *obj ) const.
Two objects of the same class can be added with void Add(const crn::Object *v) and compared with bool Equals(const crn::Object *v) const.
A group is a magma defining subtraction: void Sub(const crn::Object *v).
A vector over ℝ is a group that defines the external multiplication by a real number: void Mult(double m). Consequently, it also defines the weighted sum with CRNObject Sum(const std::vector<std::pair\<const crn::object*,="" double=""> > &plist) const</std::pair\<const> and the weighted mean with CRNObject Mean(const std::vector<std::pair\<const crn::object*,="" double=""> > &plist) const</std::pair\<const>.
A ring is a group that defines an internal multiplication: void Mult(const crn::Object *obj).
A field is a ring that defines an internal division: void Div(const crn::Object *obj).
A partially ordered set defines an order for some of its elements. Therefore, the methods GE() (greater or equal), LE() (lesser or equal), GT() (greater than) and LT() (lesser than) return a crn::Prop3, which can take the following values: True, False or Unknown.
A savable object can be read from a standalone file (generally in XML) with void Load(const Path &fname), and saved with void Save(const Path &fname). Once the object was saved, it can be saved again with void Save() and its file name can be queried with const Path& GetFilename() const.
If the path given to Load() and Save() is relative, it is competed by the method virtual const Path completeFilename(const Path &fn) const, which allows to define a default path to store objects of a same class.
An algebra is a ring and a vector over ℝ.
A feature is serializable, clonable and metric.