Adaptagrams
Public Member Functions | List of all members
dialect::Assignment Struct Reference

Represents an assignment of nbrs to semiaxes, and records the cost of this assignment. More...

#include <quadaction.h>

Collaboration diagram for dialect::Assignment:
Collaboration graph

Public Member Functions

 Assignment (const Nbrs &semis, double cost)
 Standard constructor. More...
 
 Assignment (void)
 Default constructor. More...
 
size_t cardinality (void) const
 Return the "cardinality" of this Assignment, i.e. the number of Nbrs assigned to semiaxes.
 
Assignment makeUnion (const Assignment &other) const
 Create union of two Assignments. More...
 
std::string toString (void) const
 Write a string representation, listing the id of the Nbr assigned to each semiaxis. For example if Nbrs 3, 7, 8 are assigned to semiaxes E, S, N resp., represent this as "3 7 - 8". More...
 

Detailed Description

Represents an assignment of nbrs to semiaxes, and records the cost of this assignment.

Constructor & Destructor Documentation

◆ Assignment() [1/2]

dialect::Assignment::Assignment ( const Nbrs &  semis,
double  cost 
)
inline

Standard constructor.

Parameters
[in]semisvector of four shared ptrs to Nbrs, representing the Nbrs assigned to the four semiaxes, starting with East and proceding clockwise. Should be equal to nullptr if no Nbr is present on a given semiaxis.
[in]costthe cost of this assignment, which measures the sum of angular displacements of Nbrs from their original positions

◆ Assignment() [2/2]

dialect::Assignment::Assignment ( void  )
inline

Default constructor.

Constructs an "empty" Assignment, with no Nbrs and zero cost.

Referenced by makeUnion().

Here is the caller graph for this function:

Member Function Documentation

◆ makeUnion()

Assignment Assignment::makeUnion ( const Assignment other) const

Create union of two Assignments.

Returns
A new Assignment representing the union of this one with the other.
Note
This function assumes you never try to put more than one Nbr on a given semiaxis. If you do, you will get an incorrect result; an exception will not be raised.

References Assignment().

Here is the call graph for this function:

◆ toString()

string Assignment::toString ( void  ) const

Write a string representation, listing the id of the Nbr assigned to each semiaxis. For example if Nbrs 3, 7, 8 are assigned to semiaxes E, S, N resp., represent this as "3 7 - 8".

Returns
string representation.

References dialect::string_format().

Here is the call graph for this function:

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