Skip to content

Libs/Optimize/Container/GenericContainerArray.h

Namespaces

Name
shapeworks
User usage reporting (telemetry)

Classes

Name
class shapeworks::GenericContainerArray
This class appears to be an array of GenericContainers (e.g. std::vector) that implements the Observer interface. The array size tracks the number of domains in the system. E.g. one per domain.

Source code

```cpp

pragma once

include

include "GenericContainer.h"

include "Observer.h"

include "itkDataObject.h"

include "ParticleEvents.h"

include "itkWeakPointer.h"

namespace shapeworks {

template class GenericContainerArray : public std::vector::Pointer>, public Observer { public: typedef T DataType; typedef GenericContainerArray Self; typedef Observer Superclass; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; typedef itk::WeakPointer ConstWeakPointer;

itkNewMacro(Self);

itkTypeMacro(GenericContainerArray, Observer);

virtual void DomainAddEventCallback(Object*, const itk::EventObject&) { this->resize(this->size() + 1); this->operator = GenericContainer::New(); }

virtual void PositionAddEventCallback(Object* o, const itk::EventObject& e) { const ParticlePositionAddEvent& event = dynamic_cast(e); this->operator->operator = 0.0; }

virtual void PositionRemoveEventCallback(Object*, const itk::EventObject&) { // NEED TO IMPLEMENT THIS }

void ZeroAllValues() { for (unsigned d = 0; d < this->size(); d++) { for (unsigned int i = 0; i < this->operator->GetSize(); i++) { this->operator->operator = 0.0; } } }

protected: GenericContainerArray() { this->m_DefinedCallbacks.DomainAddEvent = true; this->m_DefinedCallbacks.PositionAddEvent = true; this->m_DefinedCallbacks.PositionRemoveEvent = true; } virtual ~GenericContainerArray(){};

void PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); }

private: GenericContainerArray(const Self&); // purposely not implemented void operator=(const Self&); // purposely not implemented };

} // namespace shapeworks ```


Updated on 2026-03-31 at 16:02:11 +0000