creativity  v1.3.0
Agent-based model of creativity and piracy
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
creativity::data::UnaryExpr Class Reference

Base class for composite variables with a single variable. More...

#include <creativity/data/Variable.hpp>

Public Member Functions

virtual unsigned int size () const override
 Returns the size of the unary expression, if the variable has a size. More...
 
- Public Member Functions inherited from creativity::data::Variable
virtual ~Variable ()=default
 Virtual destructor.
 
virtual std::string name () const =0
 Returns a name for this variable.
 
virtual std::string nameBracketed (const std::string &bracketL="(", const std::string &bracketR=")") const
 Returns a name for this variable, but with surrounding brackets if this variable needs it–for example, for a multiplication of two variables. More...
 
virtual void populate (Eigen::Ref< Eigen::VectorXd > column, unsigned int offset=0, unsigned int trim=0) const =0
 Populates the given column reference with this variable's values. More...
 
Eigen::VectorXd values (unsigned int rows=0, unsigned int offset=0, unsigned int trim=0) const
 Shortcut wrapper around populate that creates a new column of the given size, calls populate() with it, then returns it. More...
 

Protected Member Functions

 UnaryExpr ()=delete
 Not default-constructible.
 
 UnaryExpr (const std::shared_ptr< const Variable > &var)
 Constructs a unary variable.
 

Protected Attributes

std::shared_ptr< const Variablevar_
 The underlying unary variable.
 

Detailed Description

Base class for composite variables with a single variable.

This isn't always strictly a unary expression–it can also be used by classes that, for example, also handle a double value.

Member Function Documentation

§ size()

virtual unsigned int creativity::data::UnaryExpr::size ( ) const
overridevirtual

Returns the size of the unary expression, if the variable has a size.

If it doesn't throws a SizeError exception.

Implements creativity::data::Variable.

Inheritance diagram for creativity::data::UnaryExpr:
[legend]
Collaboration diagram for creativity::data::UnaryExpr:
[legend]

The documentation for this class was generated from the following file: