FIMS  v0.8.0
Loading...
Searching...
No Matches
rcpp_shared_primitive.hpp File Reference

Code to create shared pointers to allow for the wrapper functions in R to work correctly so the live objects do not go out of scope. More...

#include <memory>

Go to the source code of this file.

Classes

class  SharedInt
 A class that provides shared ownership of an integer value. More...
 
class  SharedReal
 A class that provides shared ownership of an integer value. More...
 
class  SharedString
 A class that provides shared ownership of a string. More...
 
class  SharedBoolean
 A class that provides shared ownership of a boolean value. More...
 

Typedefs

typedef SharedInt fims_int
 An alias for the SharedInt class.
 
typedef SharedReal fims_double
 An alias for the SharedReal class.
 
typedef SharedString fims_string
 An alias for the SharedString class.
 
typedef SharedBoolean fims_bool
 An alias for the SharedBoolean class.
 

Functions

SharedInt operator+ (const int &lhs, const SharedInt &rhs)
 Overloads the binary addition operator (+) for an integer left-hand side operand.
 
SharedInt operator- (const int &lhs, const SharedInt &rhs)
 Overloads the binary subtraction operator (-) for an integer left-hand side operand.
 
SharedInt operator* (const int &lhs, const SharedInt &rhs)
 Overloads the binary multiplication operator (*) for an integer left-hand side operand.
 
SharedInt operator/ (const int &lhs, const SharedInt &rhs)
 Overloads the binary division operator (/) for an integer left-hand side operand.
 
bool operator< (const int &lhs, const SharedInt &rhs)
 Overloads the less-than operator (<) for an integer left-hand side operand.
 
bool operator<= (const int &lhs, const SharedInt &rhs)
 Overloads the less-than-or-equal-to operator (<=) for an integer left-hand side operand.
 
bool operator> (const int &lhs, const SharedInt &rhs)
 Overloads the greater-than operator (>) for an integer left-hand side operand.
 
bool operator>= (const int &lhs, const SharedInt &rhs)
 Overloads the greater-than-or-equal-to operator (>=) for an integer left-hand side operand.
 
SharedReal operator+ (const double &lhs, const SharedReal &rhs)
 Overloads the binary addition operator (+) for a double left-hand side operand.
 
SharedReal operator- (const double &lhs, const SharedReal &rhs)
 Overloads the binary subtraction operator (-) for a double left-hand side operand.
 
SharedReal operator* (const double &lhs, const SharedReal &rhs)
 Overloads the binary multiplication operator (*) for a double left-hand side operand.
 
SharedReal operator/ (const double &lhs, const SharedReal &rhs)
 Overloads the binary division operator (/) for a double left-hand side operand.
 
bool operator< (const bool &lhs, const SharedBoolean &rhs)
 Overloads the less-than operator (<) for a boolean left-hand side operand.
 
bool operator<= (const bool &lhs, const SharedBoolean &rhs)
 Overloads the less-than-or-equal-to operator (<=) for a boolean left-hand side operand.
 
bool operator> (const bool &lhs, const SharedBoolean &rhs)
 Overloads the greater-than operator (>) for a boolean left-hand side operand.
 
bool operator>= (const bool &lhs, const SharedBoolean &rhs)
 Overloads the greater-than-or-equal-to operator (>=) for a boolean left-hand side operand.
 

Detailed Description

Code to create shared pointers to allow for the wrapper functions in R to work correctly so the live objects do not go out of scope.

Typedef Documentation

◆ fims_bool

An alias for the SharedBoolean class.

This alias is used to conform to the fims naming convention, representing a reference-counted boolean.

◆ fims_double

An alias for the SharedReal class.

This alias is used to conform to the fims naming convention, representing a reference-counted real number (integer).

◆ fims_int

An alias for the SharedInt class.

This alias is used to conform to the fims naming convention, representing a reference-counted integer.

◆ fims_string

An alias for the SharedString class.

This alias is used to conform to the fims naming convention, representing a reference-counted string.

Function Documentation

◆ operator*() [1/2]

SharedReal operator* ( const double lhs,
const SharedReal rhs 
)

Overloads the binary multiplication operator (*) for a double left-hand side operand.

Multiplies a double by a SharedReal's value, returning a new SharedReal object with the product.

Parameters
lhsThe double value on the left-hand side of the operator.
rhsThe SharedReal object on the right-hand side.
Returns
A new SharedReal object containing the product.

◆ operator*() [2/2]

SharedInt operator* ( const int lhs,
const SharedInt rhs 
)

Overloads the binary multiplication operator (*) for an integer left-hand side operand.

Multiplies an integer by a SharedInt's value, returning a new SharedInt object with the product.

Parameters
lhsThe integer value on the left-hand side of the operator.
rhsThe SharedInt object on the right-hand side.
Returns
A new SharedInt object containing the product.

◆ operator+() [1/2]

SharedReal operator+ ( const double lhs,
const SharedReal rhs 
)

Overloads the binary addition operator (+) for a double left-hand side operand.

Adds a double to a SharedReal's value, returning a new SharedReal object with the result. This enables expressions like 5.0 + my_shared_real.

Parameters
lhsThe double value on the left-hand side of the operator.
rhsThe SharedReal object on the right-hand side.
Returns
A new SharedReal object containing the sum.

◆ operator+() [2/2]

SharedInt operator+ ( const int lhs,
const SharedInt rhs 
)

Overloads the binary addition operator (+) for an integer left-hand side operand.

Adds an integer to a SharedInt's value, returning a new SharedInt object with the result. This enables expressions like 5 + my_shared_int.

Parameters
lhsThe integer value on the left-hand side of the operator.
rhsThe SharedInt object on the right-hand side.
Returns
A new SharedInt object containing the sum.

◆ operator-() [1/2]

SharedReal operator- ( const double lhs,
const SharedReal rhs 
)

Overloads the binary subtraction operator (-) for a double left-hand side operand.

Subtracts a SharedReal's value from a double, returning a new SharedReal object with the result. This enables expressions like 10.0 - my_shared_real.

Parameters
lhsThe double value on the left-hand side of the operator.
rhsThe SharedReal object on the right-hand side.
Returns
A new SharedReal object containing the result of the subtraction.

◆ operator-() [2/2]

SharedInt operator- ( const int lhs,
const SharedInt rhs 
)

Overloads the binary subtraction operator (-) for an integer left-hand side operand.

Subtracts a SharedInt's value from an integer, returning a new SharedInt object with the result. This enables expressions like 10 - my_shared_int.

Parameters
lhsThe integer value on the left-hand side of the operator.
rhsThe SharedInt object on the right-hand side.
Returns
A new SharedInt object containing the result of the subtraction.

◆ operator/() [1/2]

SharedReal operator/ ( const double lhs,
const SharedReal rhs 
)

Overloads the binary division operator (/) for a double left-hand side operand.

Divides a double by a SharedReal's value, returning a new SharedReal object with the quotient.

Parameters
lhsThe double value on the left-hand side of the operator.
rhsThe SharedReal object on the right-hand side.
Returns
A new SharedReal object containing the quotient.

◆ operator/() [2/2]

SharedInt operator/ ( const int lhs,
const SharedInt rhs 
)

Overloads the binary division operator (/) for an integer left-hand side operand.

Divides an integer by a SharedInt's value, returning a new SharedInt object with the quotient.

Parameters
lhsThe integer value on the left-hand side of the operator.
rhsThe SharedInt object on the right-hand side.
Returns
A new SharedInt object containing the quotient.

◆ operator<() [1/2]

bool operator< ( const bool lhs,
const SharedBoolean rhs 
)

Overloads the less-than operator (<) for a boolean left-hand side operand.

Compares a boolean to a SharedBoolean's value.

Parameters
lhsThe boolean value on the left-hand side of the operator.
rhsThe SharedBoolean object on the right-hand side.
Returns
true if the boolean is less than the SharedBoolean's value, false otherwise.

◆ operator<() [2/2]

bool operator< ( const int lhs,
const SharedInt rhs 
)

Overloads the less-than operator (<) for an integer left-hand side operand.

Compares an integer to a SharedInt's value.

Parameters
lhsThe integer value on the left-hand side of the operator.
rhsThe SharedInt object on the right-hand side.
Returns
true if the integer is less than the SharedInt's value, false otherwise.

◆ operator<=() [1/2]

bool operator<= ( const bool lhs,
const SharedBoolean rhs 
)

Overloads the less-than-or-equal-to operator (<=) for a boolean left-hand side operand.

Compares a boolean to a SharedBoolean's value.

Parameters
lhsThe boolean value on the left-hand side of the operator.
rhsThe SharedBoolean object on the right-hand side.
Returns
true if the boolean is less than or equal to the SharedBoolean's value, false otherwise.

◆ operator<=() [2/2]

bool operator<= ( const int lhs,
const SharedInt rhs 
)

Overloads the less-than-or-equal-to operator (<=) for an integer left-hand side operand.

Compares an integer to a SharedInt's value.

Parameters
lhsThe integer value on the left-hand side of the operator.
rhsThe SharedInt object on the right-hand side.
Returns
true if the integer is less than or equal to the SharedInt's value, false otherwise.

◆ operator>() [1/2]

bool operator> ( const bool lhs,
const SharedBoolean rhs 
)

Overloads the greater-than operator (>) for a boolean left-hand side operand.

Compares a boolean to a SharedBoolean's value.

Parameters
lhsThe boolean value on the left-hand side of the operator.
rhsThe SharedBoolean object on the right-hand side.
Returns
true if the boolean is greater than the SharedBoolean's value, false otherwise.

◆ operator>() [2/2]

bool operator> ( const int lhs,
const SharedInt rhs 
)

Overloads the greater-than operator (>) for an integer left-hand side operand.

Compares an integer to a SharedInt's value.

Parameters
lhsThe integer value on the left-hand side of the operator.
rhsThe SharedInt object on the right-hand side.
Returns
true if the integer is greater than the SharedInt's value, false otherwise.

◆ operator>=() [1/2]

bool operator>= ( const bool lhs,
const SharedBoolean rhs 
)

Overloads the greater-than-or-equal-to operator (>=) for a boolean left-hand side operand.

Compares a boolean to a SharedBoolean's value.

Parameters
lhsThe boolean value on the left-hand side of the operator.
rhsThe SharedBoolean object on the right-hand side.
Returns
true if the boolean is greater than or equal to the SharedBoolean's value, false otherwise.

◆ operator>=() [2/2]

bool operator>= ( const int lhs,
const SharedInt rhs 
)

Overloads the greater-than-or-equal-to operator (>=) for an integer left-hand side operand.

Compares an integer to a SharedInt's value.

Parameters
lhsThe integer value on the left-hand side of the operator.
rhsThe SharedInt object on the right-hand side.
Returns
true if the integer is greater than or equal to the SharedInt's value, false otherwise.