#include <Teuchos_Workspace.hpp>
Collaboration diagram for Teuchos::Workspace< T >:
Public Member Functions | |
| Workspace (WorkspaceStore *workspace_store, size_t num_elements, bool call_constructors=true) | |
| Allocates a num_elements array of temporary objects. | |
| ~Workspace () | |
The destructor on the elements will only be called if call_constructors == true was passed to the constructor. | |
| size_t | size () const |
| Return the number of elements in the array. | |
| T & | operator[] (size_t i) |
| Non-const zero based element access. | |
| const T & | operator[] (size_t i) const |
| Const zero based element access. | |
Private Member Functions | |
| Workspace () | |
| Workspace (const RawWorkspace &) | |
| Workspace & | operator= (const RawWorkspace &) |
Static Private Member Functions | |
| void * | operator new (size_t) |
| void | operator delete (void *) |
Private Attributes | |
| RawWorkspace | raw_workspace_ |
| bool | call_constructors_ |
Objects of this type are what should be created by the user instead of RawWorkspace objects since this class will properly initialize memory using placement new and allows typed operator[] access to the array elements. The default constructor, copy constructor and assignment operations are not allowed and objects can not be allocated with new.
It is important to note that the constructors and destructors will only be called if call_constructors=true (the default) is passed to the consructor Workspace(). For build-in types that do not need constructors and destructors called, the client should pass in call_constructors=false . Otherwise we would have to call constructors and destructors on all of the memory and that could considerably slow things down.
With simple built-in data types (i.e. call_constructors=false) the cost of creating and destroying one of these objects should be O(1) independent of how much data is requested. This is true as long as no dynamic memory has to be allocated (this is determined the object workspace_store passed to the constructor Workspace()).
Definition at line 168 of file Teuchos_Workspace.hpp.
|
||||||||||||||||||||
|
Allocates a num_elements array of temporary objects.
Definition at line 345 of file Teuchos_Workspace.hpp. |
|
|||||||||
|
The destructor on the elements will only be called if
Definition at line 357 of file Teuchos_Workspace.hpp. |
|
|||||||||
|
|
|
||||||||||
|
|
|
|||||||||
|
Return the number of elements in the array.
Definition at line 369 of file Teuchos_Workspace.hpp. |
|
||||||||||
|
Non-const zero based element access. Preconditions:
Definition at line 376 of file Teuchos_Workspace.hpp. |
|
||||||||||
|
Const zero based element access. Preconditions:
Definition at line 386 of file Teuchos_Workspace.hpp. |
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
Definition at line 404 of file Teuchos_Workspace.hpp. |
|
|||||
|
Definition at line 227 of file Teuchos_Workspace.hpp. |
|
|||||
|
Definition at line 228 of file Teuchos_Workspace.hpp. |
1.3.9.1