![]() |
FIMS
v0.10.0
|
A class that provides shared ownership of a boolean value. More...
#include <rcpp_shared_primitive.hpp>
Public Member Functions | |
| SharedBoolean () | |
| Constructs a new SharedBoolean object with a default value. | |
| SharedBoolean (bool val) | |
| Constructs a new SharedBoolean object from a boolean value. | |
| SharedBoolean (const SharedBoolean &other) | |
| Copy constructs a new SharedBoolean object. | |
| SharedBoolean & | operator= (const SharedBoolean &other) |
| Overloaded copy assignment operator. | |
| SharedBoolean & | operator= (const bool &other) |
| Overloaded assignment operator for a boolean value. | |
| SharedBoolean (SharedBoolean &&other) noexcept | |
| Constructs a new SharedBoolean object by moving resources. | |
| SharedBoolean & | operator= (SharedBoolean &&other) noexcept |
| Overloaded move assignment operator. | |
| bool | get () const |
| Retrieves the boolean value managed by the object. | |
| void | set (bool val) |
| Sets the boolean value of the object. | |
| operator bool () | |
User-defined conversion to bool. | |
| bool | operator* () const |
Overloads the dereference operator (*). | |
| bool * | operator-> () |
Overloads the member access operator (->). | |
| const bool * | operator-> () const |
Overloads the member access operator (->) for const objects. | |
| bool | operator== (const SharedBoolean &other) const |
Overloads the equality operator (==). | |
| bool | operator!= (const SharedBoolean &other) const |
Overloads the inequality operator (!=). | |
| bool | operator< (const SharedBoolean &other) const |
Overloads the less-than operator (<). | |
| bool | operator<= (const SharedBoolean &other) const |
Overloads the less-than-or-equal-to operator (<=). | |
| bool | operator> (const SharedBoolean &other) const |
Overloads the greater-than operator (>). | |
| bool | operator>= (const SharedBoolean &other) const |
Overloads the greater-than-or-equal-to operator (>=). | |
| bool | operator== (const bool &other) const |
Overloads the equality operator (==) for a boolean value. | |
| bool | operator!= (const bool &other) const |
Overloads the inequality operator (!=) for a boolean value. | |
| bool | operator< (const bool &other) const |
Overloads the less-than operator (<) for a boolean value. | |
| bool | operator<= (const bool &other) const |
Overloads the less-than-or-equal-to operator (<=) for a boolean. | |
| bool | operator> (const bool &other) const |
Overloads the greater-than operator (>) for a boolean value. | |
| bool | operator>= (const bool &other) const |
Overloads the greater-than-or-equal-to operator (>=) for a boolean. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const SharedBoolean &sp) |
Overloads the stream insertion operator (<<) for SharedBoolean. | |
A class that provides shared ownership of a boolean value.
This class wraps a std::shared_ptr to provide a reference-counted boolean value. When a SharedBoolean object is copied, it shares the same underlying boolean with the original object. The boolean's memory is automatically deallocated when the last SharedBoolean object pointing to it is destroyed.
|
inline |
Constructs a new SharedBoolean object with a default value.
Initializes the object's internal shared pointer to manage a new boolean with a default value of false.
|
inline |
Constructs a new SharedBoolean object from a boolean value.
Initializes the object's internal shared pointer to manage a new boolean with the value provided by the val parameter.
| val | The boolean value to be stored in the shared pointer. |
|
inline |
Copy constructs a new SharedBoolean object.
Initializes the object by creating a new shared pointer that shares ownership of the boolean managed by another SharedBoolean object.
| other | The existing SharedBoolean object to copy from. |
|
inlinenoexcept |
Constructs a new SharedBoolean object by moving resources.
Transfers ownership of the shared boolean from other to the new object. This is a non-throwing operation that is more efficient than a copy.
| other | The temporary SharedBoolean object to move from. After this call, other will no longer own the resource. |
|
inline |
Retrieves the boolean value managed by the object.
This is a getter function that returns a copy of the boolean value. Since the function is const, it can be safely called on a constant instance of the class without modifying its state.
|
inline |
User-defined conversion to bool.
This conversion operator allows the object to be implicitly converted to a bool. The returned value is the boolean managed by the object's internal shared pointer.
|
inline |
Overloads the inequality operator (!=) for a boolean value.
Compares the boolean value of the current object with a bool for inequality. This is a non-mutating operation.
| other | The boolean value to compare against. |
true if the values are not equal, false otherwise.
|
inline |
Overloads the inequality operator (!=).
Compares the boolean value of the current object with the boolean value of other for inequality. This is a non-mutating operation.
| other | The SharedBoolean object to compare against. |
true if the values are not equal, false otherwise.
|
inline |
Overloads the dereference operator (*).
Provides direct access to the boolean value managed by the internal shared pointer. This function is const and provides a read-only view of the data.
|
inline |
Overloads the member access operator (->).
This function provides a way to access the underlying boolean value by returning a raw pointer to it. It returns the result of the std::shared_ptr::get() method.
bool*) to the boolean managed by the shared pointer.
|
inline |
Overloads the member access operator (->) for const objects.
This function provides a way to get a read-only raw pointer to the underlying boolean. The const return type prevents modification of the boolean value through this pointer. The function itself is also const, ensuring it can be called on const instances of the class.
const raw pointer to the boolean managed by the shared pointer.
|
inline |
Overloads the less-than operator (<) for a boolean value.
Compares the boolean value of the current object with a bool. This is a non-mutating operation.
| other | The boolean value to compare against. |
true if the current object's value is less than other, false otherwise.
|
inline |
Overloads the less-than operator (<).
Compares the boolean value of the current object with the boolean value of other. This is a non-mutating operation.
| other | The SharedBoolean object to compare against. |
true if the current object's value is less than other's value, false otherwise.
|
inline |
Overloads the less-than-or-equal-to operator (<=) for a boolean.
Compares the boolean value of the current object with a bool. This is a non-mutating operation.
| other | The boolean value to compare against. |
true if the current object's value is less than or equal to other, false otherwise.
|
inline |
Overloads the less-than-or-equal-to operator (<=).
Compares the boolean value of the current object with the boolean value of other. This is a non-mutating operation.
| other | The SharedBoolean object to compare against. |
true if the current object's value is less than or equal to other's value, false otherwise.
|
inline |
Overloaded assignment operator for a boolean value.
Assigns a new boolean value to the underlying shared boolean, modifying the object in place.
| other | The boolean value to assign. |
*this) to allow for chained assignments.
|
inline |
Overloaded copy assignment operator.
Assigns the shared state of other to the current object. If the objects are not the same, the current object will release its old resource and share ownership of the boolean value managed by other.
| other | The SharedBoolean object to assign from. |
*this) to allow for chained assignments.
|
inlinenoexcept |
Overloaded move assignment operator.
Moves the shared state from other to the current object, releasing any resources the current object might have held. This is a non-throwing and more efficient operation than a copy assignment.
| other | The temporary SharedBoolean object to move from. |
*this).
|
inline |
Overloads the equality operator (==) for a boolean value.
Compares the boolean value of the current object with a bool for equality. This is a non-mutating operation.
| other | The boolean value to compare against. |
true if the values are equal, false otherwise.
|
inline |
Overloads the equality operator (==).
Compares the boolean value of the current object with the boolean value of other for equality. This is a non-mutating operation.
| other | The SharedBoolean object to compare against. |
true if the values are equal, false otherwise.
|
inline |
Overloads the greater-than operator (>) for a boolean value.
Compares the boolean value of the current object with a bool. This is a non-mutating operation.
| other | The boolean value to compare against. |
true if the current object's value is greater than other, false otherwise.
|
inline |
Overloads the greater-than operator (>).
Compares the boolean value of the current object with the boolean value of other. This is a non-mutating operation.
| other | The SharedBoolean object to compare against. |
true if the current object's value is greater than other's value, false otherwise.
|
inline |
Overloads the greater-than-or-equal-to operator (>=) for a boolean.
Compares the boolean value of the current object with a bool. This is a non-mutating operation.
| other | The boolean value to compare against. |
true if the current object's value is greater than or equal to other, false otherwise.
|
inline |
Overloads the greater-than-or-equal-to operator (>=).
Compares the boolean value of the current object with the boolean value of other. This is a non-mutating operation.
| other | The SharedBoolean object to compare against. |
true if the current object's value is greater than or equal to other's value, false otherwise.
|
inline |
Sets the boolean value of the object.
Assigns a new boolean value to the underlying shared boolean.
| val | The boolean value to set. |
|
friend |
Overloads the stream insertion operator (<<) for SharedBoolean.
Provides a way to print the boolean value of a SharedBoolean object to an output stream.
| os | The output stream to write to. |
| sp | The SharedBoolean object to print. |