codac 2.0.0
Loading...
Searching...
No Matches
codac2::VarBase Class Referenceabstract

Abstract base class for representing variables in analytic or set functions. More...

#include <codac2_VarBase.h>

Public Member Functions

virtual ~VarBase ()=default
 Virtual destructor for the VarBase class.
 
virtual const ExprIDunique_id () const =0
 Returns the unique identifier of the variable.
 
virtual std::shared_ptr< VarBasearg_copy () const =0
 Creates a copy of the argument.
 
virtual Index size () const =0
 Returns the mathematical size of the variable.
 

Detailed Description

Abstract base class for representing variables in analytic or set functions.

The VarBase class serves as the abstract base for various types of variable representations, such as scalar, vector, and matrix variables.

Constructor & Destructor Documentation

◆ ~VarBase()

virtual codac2::VarBase::~VarBase ( )
virtualdefault

Virtual destructor for the VarBase class.

The destructor is virtual to ensure proper cleanup of derived classes.

Member Function Documentation

◆ unique_id()

virtual const ExprID & codac2::VarBase::unique_id ( ) const
pure virtual

Returns the unique identifier of the variable.

Each instance of a derived class should have a unique identifier to distinguish it from other variables. This ID is used to identify the variable (or any expression) independently of its memory address.

Returns
A constant reference to the unique identifier of the variable.

◆ arg_copy()

virtual std::shared_ptr< VarBase > codac2::VarBase::arg_copy ( ) const
pure virtual

Creates a copy of the argument.

This method should return a deep copy of the variable.

Returns
A shared pointer to a new instance of the variable (copy of the original).

◆ size()

virtual Index codac2::VarBase::size ( ) const
pure virtual

Returns the mathematical size of the variable.

For scalar variables, the size is 1. For vector variables of \(\mathbb{R}^n\), the size is \(n\). For matrix variables of \(r\) rows and \(c\) columns, the size is \(r\times c\).

Returns
The size of the variable, typically the number of components.

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