Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::math_opt::ModelStorageItemContainer Class Reference

Detailed Description

Represents an item that contains a bunch of items that live in the same model storage. The container is considered to be associated to a given model iff it has at least one item. Derived classes should maintain this invariant. In particular, they should call SetOrCheckStorage when an item is added and they should clear the storage when becoming empty (this includes being moved from if that clears the items in the container, see comments on the move constructor).

Definition at line 157 of file model_storage_item.h.

#include <model_storage_item.h>

Inheritance diagram for operations_research::math_opt::ModelStorageItemContainer:
operations_research::math_opt::LinearExpression operations_research::math_opt::QuadraticExpression

Public Member Functions

NullableModelStorageCPtr storage () const

Protected Member Functions

 ModelStorageItemContainer (const NullableModelStorageCPtr storage=nullptr)
 ModelStorageItemContainer (const ModelStorageItemContainer &other)=default
ModelStorageItemContaineroperator= (const ModelStorageItemContainer &other)=default
 ModelStorageItemContainer (ModelStorageItemContainer &&other)
ModelStorageItemContaineroperator= (ModelStorageItemContainer &&other)
void SetOrCheckStorage (const ModelStorageItem &item)
void SetOrCheckStorage (const ModelStorageItemContainer &container)

Constructor & Destructor Documentation

◆ ModelStorageItemContainer() [1/3]

operations_research::math_opt::ModelStorageItemContainer::ModelStorageItemContainer ( const NullableModelStorageCPtr storage = nullptr)
inlineexplicitprotected

Definition at line 165 of file model_storage_item.h.

◆ ModelStorageItemContainer() [2/3]

operations_research::math_opt::ModelStorageItemContainer::ModelStorageItemContainer ( const ModelStorageItemContainer & other)
protecteddefault

◆ ModelStorageItemContainer() [3/3]

operations_research::math_opt::ModelStorageItemContainer::ModelStorageItemContainer ( ModelStorageItemContainer && other)
inlineprotected

When moving we're leaving the moved-from object unassociated with any model. Derived classes should hold no items after being moved from.

Definition at line 177 of file model_storage_item.h.

Member Function Documentation

◆ operator=() [1/2]

ModelStorageItemContainer & operations_research::math_opt::ModelStorageItemContainer::operator= ( const ModelStorageItemContainer & other)
protecteddefault

◆ operator=() [2/2]

ModelStorageItemContainer & operations_research::math_opt::ModelStorageItemContainer::operator= ( ModelStorageItemContainer && other)
inlineprotected

Definition at line 179 of file model_storage_item.h.

◆ SetOrCheckStorage() [1/2]

void operations_research::math_opt::ModelStorageItemContainer::SetOrCheckStorage ( const ModelStorageItem & item)
inlineprotected

Sets the storage_ to the input value if nullptr, else CHECKs that item is associated with the same storage.

Definition at line 186 of file model_storage_item.h.

◆ SetOrCheckStorage() [2/2]

void operations_research::math_opt::ModelStorageItemContainer::SetOrCheckStorage ( const ModelStorageItemContainer & container)
inlineprotected

Same as above, but additionally checks that the input container is already associated with a storage.

Definition at line 192 of file model_storage_item.h.

◆ storage()

NullableModelStorageCPtr operations_research::math_opt::ModelStorageItemContainer::storage ( ) const
inline

Returns nullptr if the container is not associated with any model (SetOrCheckStorage has never been called, or the container was emptied/moved from).

Definition at line 162 of file model_storage_item.h.


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