Semantic Object File.
More...
#include <sof.h>
|
| | SOF (const std::string &p_name, const std::string &p_mode) |
| | Ctor from a name.
|
| |
|
| SOF (const SOF &p_other) |
| | Copy ctor.
|
| |
|
| ~SOF () override |
| | Dtor.
|
| |
|
| SOF (SOF &&)=delete |
| |
|
SOF & | operator= (const SOF &)=delete |
| |
|
SOF & | operator= (SOF &&)=delete |
| |
|
std::string | getFName () const |
| | Returns the file name.
|
| |
|
std::string | getFMode () const |
| | Returns the file mode.
|
| |
| SOF * | dup () const override |
| | Creates a new instance as copy following the red book definition.
|
| |
| std::string | opequal () const override |
| | String representation of object for operators '=', 'cvs' and 'stack'.
|
| |
| std::string | opequalequal () const override |
| | String representation for operators '==' and 'pstack'.
|
| |
| OTCode | ot () const override |
| | Returns an OTCode.
|
| |
| std::string | type () const override |
| | Returns a type name.
|
| |
| bool | equal (const SO *p_other) const override |
| | Checks if this SO is equal to another SO.
|
| |
| bool | isOpen () const |
| | Checks if the file is open.
|
| |
| bool | readLeonLine (std::string &p_str) |
| | Our std::getline( istream, string ) version.
|
| |
| OpError | open () |
| | Opens the file.
|
| |
| OpError | flush () |
| | Flushes the file.
|
| |
| OpError | close (int(*p_fclose)(FILE *)=fclose) |
| | Closes the file.
|
| |
| OpError | readline (std::string &p_str, bool &p_eof) |
| | Reads a line of text from file.
|
| |
| OpError | readstring (std::string &p_str, bool &p_eof) |
| | Reads text from file.
|
| |
| OpError | writestring (const std::string &p_data) |
| | Writes to file.
|
| |
| OpError | writestring (std::string_view p_data) |
| | Writes to file.
|
| |
|
| SO () |
| | Ctor.
|
| |
| | SO (bool p_exec) |
| | Ctor.
|
| |
|
| SO (const SO &p_other) |
| | Copy ctor.
|
| |
| virtual | ~SO () |
| | Virtual dtor.
|
| |
|
| SO (SO &&)=delete |
| |
|
SO & | operator= (const SO &)=delete |
| |
|
SO & | operator= (SO &&)=delete |
| |
|
bool | getExec () const |
| | Getter for exec_.
|
| |
|
void | setExec (bool p_exec) |
| | Setter for exec_.
|
| |
| virtual size_t | getSize () const |
| | Returns the size of the SO.
|
| |
| virtual SO * | clone () const |
| | Creates a new instance as copy with deep cloning.
|
| |
| virtual bool | gt (OpError &p_ec, const SO *) const |
| | Greater than.
|
| |
| virtual bool | ge (OpError &p_ec, const SO *) const |
| | Greater or equal.
|
| |
|
| Counter (Counter< SO > &&)=delete |
| |
|
Counter< SO > & | operator= (const Counter< SO > &)=delete |
| |
|
Counter< SO > & | operator= (Counter< SO > &&)=delete |
| |
|
| bool | invariant () const noexcept override |
| | Checks class invariants.
|
| |
|
| Counter () |
| | Ctor.
|
| |
|
| Counter (const Counter< SO > &) |
| | Copy ctor.
|
| |
|
| ~Counter () |
| | Dtor.
|
| |
|
| ~DbC ()=default |
| | Protected dtor.
|
| |
|
|
std::shared_ptr< SOFData > | f_ |
| | The data.
|
| |
|
|
static size_t | getTotalCounter () |
| | Static getter for totaly created objects.
|
| |
|
static size_t | getAliveCounter () |
| | Static getter for objects alive.
|
| |
|
static size_t | getWatermarkCounter () |
| | Static getter for the object counter watermark.
|
| |
Semantic Object File.
- Invariant
- shared pointer is not null.
◆ SOF()
| SOF::SOF |
( |
const std::string & |
p_name, |
|
|
const std::string & |
p_mode |
|
) |
| |
|
inlineexplicit |
Ctor from a name.
- Parameters
-
| [in] | p_name | The file name. |
| [in] | p_mode | The file open mode. |
◆ close()
| OpError SOF::close |
( |
int(*)(FILE *) |
p_fclose = fclose | ) |
|
Closes the file.
Can be called for already closed files.
- Parameters
-
| [in] | p_fclose | Can be set to a fclose() function for mocking in unit tests. |
- Returns
- OpError ... The error code or success.
◆ dup()
Creates a new instance as copy following the red book definition.
- Returns
- SO * ... A copy.
Implements SO.
◆ equal()
| bool SOF::equal |
( |
const SO * |
p_other | ) |
const |
|
inlineoverridevirtual |
Checks if this SO is equal to another SO.
Equality means:
SOL und SOM are always equal.
For SOD, SOF and SOK, share_ptr<> points to the same object.
For SOA, share_ptr<> points to the same object, but empty arrays are equal nonetheless.
For SOO and SOo the function pointer must be the same.
Otherwise the value must be the same, even for SOS with shared_ptr<>.
- Returns
- bool ... true if the SO's are of the same type and equal
- See also
- Will be used directly and unchanged as operator eq
- Parameters
-
| [in] | p_other | The object to compare with. |
Implements SO.
◆ flush()
Flushes the file.
- Precondition
- f_->file_ == nullptr
- Returns
- OpError ... The error code or success.
◆ invariant()
| bool SOF::invariant |
( |
| ) |
const |
|
inlineoverrideprotectedvirtualnoexcept |
Checks class invariants.
- Returns
- bool ... Indicates whether the class invariants are maintained.
Reimplemented from DbC.
◆ isOpen()
| bool SOF::isOpen |
( |
| ) |
const |
|
inline |
Checks if the file is open.
- Precondition
- f_->file_ != nullptr
- Returns
- bool ... true, if the file is open.
◆ open()
Opens the file.
- Precondition
- f_->file_ == nullptr
- Returns
- OpError ... The error code or success.
◆ opequal()
| std::string SOF::opequal |
( |
| ) |
const |
|
inlineoverridevirtual |
String representation of object for operators '=', 'cvs' and 'stack'.
- Returns
- std::string ... The representation.
Implements SO.
◆ opequalequal()
| std::string SOF::opequalequal |
( |
| ) |
const |
|
inlineoverridevirtual |
String representation for operators '==' and 'pstack'.
This function attempts to produce a result that resembles the red book syntax
for creating the object.
- Returns
- std::string ... The representation.
Reimplemented from SO.
◆ ot()
Returns an OTCode.
A "manual" implementation of polymorphism, where C++-polymorphisms fail
- Returns
- OTCode ... The OTCode of the instance.
Implements SO.
◆ readLeonLine()
| bool SOF::readLeonLine |
( |
std::string & |
p_str | ) |
|
Our std::getline( istream, string ) version.
- Precondition
- f_->file_ != nullptr
- Parameters
-
| [out] | p_str | Will be cleared and filled. |
- Returns
- bool ... Success or not.
◆ readline()
| OpError SOF::readline |
( |
std::string & |
p_str, |
|
|
bool & |
p_eof |
|
) |
| |
Reads a line of text from file.
- Precondition
- p_str size <= max_int
- Parameters
-
| [in,out] | p_str | Buffer to write the text to. Limited by its size. |
| [out] | p_eof | EOF status of file after the operation. |
- Returns
- OpError ... The error code or success.
◆ readstring()
| OpError SOF::readstring |
( |
std::string & |
p_str, |
|
|
bool & |
p_eof |
|
) |
| |
Reads text from file.
- Precondition
- p_str ist not empty
- Parameters
-
| [in,out] | p_str | Buffer to write the text to. Limited by its size. |
| [out] | p_eof | EOF status of file after the operation. |
- Returns
- OpError ... The error code or success.
◆ type()
| std::string SOF::type |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns a type name.
- Returns
- std::string ... The type name of the instance.
Implements SO.
◆ writestring() [1/2]
| OpError SOF::writestring |
( |
const std::string & |
p_data | ) |
|
Writes to file.
- Parameters
-
- Returns
- OpError ... The error code or success.
◆ writestring() [2/2]
| OpError SOF::writestring |
( |
std::string_view |
p_data | ) |
|
Writes to file.
- Parameters
-
- Returns
- OpError ... The error code or success.
The documentation for this class was generated from the following files: