- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Mers::Models::Base::BaseModelSentence Class Reference

`#include <BaseModelSentence.h>`

Inheritance diagram for Mers::Models::Base::BaseModelSentence:

[legend]
Collaboration diagram for Mers::Models::Base::BaseModelSentence:

[legend]
List of all members.

## Public Types
enum | SentenceType { CNF, DNF }
| sentences are either CNF or DNF
## Public Member Functions
| BaseModelSentence (SentenceType myType, bool myOwnershipStatus)
| BaseModelSentence (BaseModelSentence const &other)
virtual | ~BaseModelSentence ()
void | setSentenceType (SentenceType newType)
SentenceType | getSentenceType () const
BaseModelSentence const & | operator= (BaseModelSentence const &other)
BaseModelSentence const & | operator+= (BaseModelSentence const &other)
BaseModelSentence const & | operator+= (BaseModelClause const &clause)
bool | operator== (BaseModelSentence const &other) const
bool | operator!= (BaseModelSentence const &other) const
void | print (std::ostream &out) const
## Static Public Member Functions
static char const * | sentenceTypeToString (SentenceType sentenceType)
## Protected Member Functions
virtual int | copy (BaseModelSentence const &sentence)
## Protected Attributes
SentenceType | sentenceType
| The type of sentence (DNF or CNF).

## Detailed Description

A BasModelClauseArray. Describes a logical sentence.

Author:
  Paul H. Elliott

Definition at line 32 of file BaseModelSentence.h.

## Constructor & Destructor Documentation

BaseModelSentence::BaseModelSentence | ( | SentenceType | myType,
|  | bool | myOwnershipStatus |
| ) |  |  |

Creates a new, empty sentence

Parameters:

  | myType | the clause type of this clause (Disjunctive or Conjunctive)
  | myOwnershipStatus | the ownership status. If true, this object owns the array objects it contains and should delete them upon being deleted.

Definition at line 27 of file BaseModelSentence.cpp.

References sentenceType.

BaseModelSentence::BaseModelSentence | ( | BaseModelSentence const & | other | ) |

Creates a new sentence with a copy of the contents from the other sentence This can be an expensive operation.

Parameters:

  | other | the sentence being copied

Definition at line 36 of file BaseModelSentence.cpp.

References sentenceType.

BaseModelSentence::~BaseModelSentence | ( |  | ) | `[virtual]`

Destroys the Sentence

Definition at line 44 of file BaseModelSentence.cpp.

## Member Function Documentation

char const * BaseModelSentence::sentenceTypeToString | ( | SentenceType | sentenceType | ) | `[static]`

Returns the string representation of the sentenceType

Parameters:

  | sentenceType | the sentence type being sought Returns the string equivalent of sentenceType

Definition at line 51 of file BaseModelSentence.cpp.

Referenced by operator+=().

void BaseModelSentence::setSentenceType | ( | SentenceType | newType | ) |

Sets the sentence type to either DNF or CNF

Parameters:

  | newType | the new type of this sentence

Definition at line 65 of file BaseModelSentence.cpp.

References sentenceType.

BaseModelSentence::SentenceType BaseModelSentence::getSentenceType | ( |  | ) | const

Returns the sentence's type

Returns:
  the SentenceType of this object

Definition at line 72 of file BaseModelSentence.cpp.

References sentenceType.

Referenced by Mers::Models::CCA::Io::Mof::MOFReader::writeConstraint(), and Mers::Models::CCA::Io::Mof::MOFReader::writeTextConstraint().

BaseModelSentence const & BaseModelSentence::operator= | ( | BaseModelSentence const & | other | ) |

copies the data from the other sentence to this sentence. This can be expensive for long sentences. The origional data in this sentence is destroyed.

Parameters:

  | other | the sentence supplying the data for this sentence

Returns:
  the other sentence

Definition at line 79 of file BaseModelSentence.cpp.

References copy().

Here is the call graph for this function:

BaseModelSentence const & BaseModelSentence::operator+= | ( | BaseModelSentence const & | other | ) |

appends a copy of the data from the other sentence to this sentence. This can be expensive for long sentences.

Parameters:

  | other | the sentence supplying the data for this sentence

Returns:
  this sentence

Definition at line 87 of file BaseModelSentence.cpp.

References Mers::Models::Base::BaseModelClauseArray::operator+=(), sentenceType, and sentenceTypeToString().

Here is the call graph for this function:

BaseModelSentence const & BaseModelSentence::operator+= | ( | BaseModelClause const & | clause | ) |

appends a copy of the clause to this sentence. Differs from pushBack, which takes ownership of the clause, but is otherwise the same

Parameters:

  | clause | the clause being copied and added to this sentence

Returns:
  this sentence

Reimplemented from Mers::Models::Base::BaseModelClauseArray.

Definition at line 99 of file BaseModelSentence.cpp.

References Mers::Models::Base::BaseModelClauseArray::operator+=().

Here is the call graph for this function:

bool BaseModelSentence::operator== | ( | BaseModelSentence const & | other | ) | const

Returns true if the two sentences have all the same clauses in the same order and the same type

Parameters:

  | other | the sentence being compared to this sentence

Returns:
  true if the two sentences have the same clauses in the same order

Definition at line 107 of file BaseModelSentence.cpp.

References sentenceType.

Referenced by operator!=().

bool BaseModelSentence::operator!= | ( | BaseModelSentence const & | other | ) | const

Returns false if the two sentences have all the same clauses in the same order and the same type

Parameters:

  | other | the sentence being compared to this sentence

Returns:
  false if the two sentences have the same clauses in the same order

Definition at line 116 of file BaseModelSentence.cpp.

References operator==().

Here is the call graph for this function:

void BaseModelSentence::print | ( | std::ostream & | out | ) | const`[virtual]`

prints the contents of this clause to the ostream out Derived classes should overide this function to change printing behavior

Parameters:

  | out | all the data from this object is printed to this ostream object

Reimplemented from Mers::Utils::Containers::DynamicArray.

Definition at line 125 of file BaseModelSentence.cpp.

References Mers::Utils::Containers::DynamicArray::getLength(), Mers::Utils::Containers::DynamicArray::printArray(), and sentenceType.

Here is the call graph for this function:

int BaseModelSentence::copy | ( | BaseModelSentence const & | sentence | ) | `[protected, virtual]`

copies the contents of the other sentence to this sentence. This destroys the contents of this sentence and copies each element in the other sentence.

Parameters:

  | sentence | the sentence being copied to this sentence

Returns:
  0 on success or a positive number if the copy failed

Definition at line 154 of file BaseModelSentence.cpp.

References Mers::Utils::Containers::DynamicArray::copy(), and sentenceType.

Referenced by operator=().

Here is the call graph for this function:

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

- /Users/fpy/titan-1-5-MBARI/Mers/Models/Base/BaseModelSentence.h
- /Users/fpy/titan-1-5-MBARI/Mers/Models/Base/BaseModelSentence.cpp