Commit 59011160 authored by Robert Maynard's avatar Robert Maynard
Browse files

model::Manager now holds a mesh::Manager, and passes it to Operators.

Now all operators of a given model::Manager can access the mesh::Manager
for the model.
parent 1aab119b
......@@ -83,6 +83,8 @@ OperatorPtr DefaultSession::op(const std::string& opName) const
RemoteOperatorPtr rop = RemoteOperator::create();
rop->setName(opName);
rop->setManager(this->manager());
rop->setMeshManager(this->meshManager());
// Naughty, but necessary so we can pretend that the
// operator existed all along.
DefaultSession* self = const_cast<DefaultSession*>(this);
......
......@@ -32,6 +32,8 @@
#include "smtk/model/Volume.h"
#include "smtk/model/VolumeUse.h"
#include "smtk/mesh/Manager.h"
#include <algorithm>
#include <set>
#include <map>
......@@ -61,6 +63,7 @@ Manager::Manager() :
m_arrangements(new UUIDsToArrangements),
m_tessellations(new UUIDsToTessellations),
m_analysisMesh(new UUIDsToTessellations),
m_meshes( smtk::mesh::Manager::create() ),
m_attributeAssignments(new UUIDsToAttributeAssignments),
m_sessions(new UUIDsToSessions),
m_globalCounters(2,1) // first entry is session counter, second is model counter
......@@ -73,7 +76,8 @@ Manager::Manager(
shared_ptr<UUIDsToEntities> inTopology,
shared_ptr<UUIDsToArrangements> inArrangements,
shared_ptr<UUIDsToTessellations> tess,
shared_ptr<UUIDsToTessellations> mesh,
shared_ptr<UUIDsToTessellations> analysismesh,
shared_ptr<smtk::mesh::Manager> meshes,
shared_ptr<UUIDsToAttributeAssignments> attribs)
:
m_topology(inTopology),
......@@ -82,7 +86,8 @@ Manager::Manager(
m_integerData(new UUIDsToIntegerData),
m_arrangements(inArrangements),
m_tessellations(tess),
m_analysisMesh(mesh),
m_analysisMesh(analysismesh),
m_meshes( meshes ),
m_attributeAssignments(attribs),
m_sessions(new UUIDsToSessions),
m_globalCounters(2,1) // first entry is session counter, second is model counter
......@@ -149,6 +154,11 @@ const UUIDsToTessellations& Manager::analysisMesh() const
return *this->m_analysisMesh.get();
}
smtk::mesh::ManagerPtr Manager::meshes() const
{
return this->m_meshes;
}
const UUIDsToAttributeAssignments& Manager::attributeAssignments() const
{
return *this->m_attributeAssignments;
......
......@@ -104,7 +104,8 @@ public:
shared_ptr<UUIDsToEntities> topology,
shared_ptr<UUIDsToArrangements> arrangements,
shared_ptr<UUIDsToTessellations> tess,
shared_ptr<UUIDsToTessellations> mesh,
shared_ptr<UUIDsToTessellations> analysismesh,
shared_ptr<smtk::mesh::Manager> meshes,
shared_ptr<UUIDsToAttributeAssignments> attribs);
virtual ~Manager();
......@@ -120,6 +121,8 @@ public:
UUIDsToTessellations& analysisMesh();
const UUIDsToTessellations& analysisMesh() const;
smtk::mesh::ManagerPtr meshes() const;
const UUIDsToAttributeAssignments& attributeAssignments() const;
BitFlags type(const smtk::common::UUID& ofEntity) const;
......@@ -403,6 +406,7 @@ protected:
smtk::shared_ptr<UUIDsToArrangements> m_arrangements;
smtk::shared_ptr<UUIDsToTessellations> m_tessellations;
smtk::shared_ptr<UUIDsToTessellations> m_analysisMesh;
smtk::shared_ptr<smtk::mesh::Manager> m_meshes;
smtk::shared_ptr<UUIDsToAttributeAssignments> m_attributeAssignments;
smtk::shared_ptr<UUIDsToSessions> m_sessions;
......
......@@ -210,6 +210,23 @@ Operator::Ptr Operator::setManager(ManagerPtr s)
return shared_from_this();
}
/// Return the meshManager associated with this operator (or a "null"/invalid shared-pointer).
smtk::mesh::ManagerPtr Operator::meshManager() const
{
return this->m_meshmanager;
}
/** Set the meshManager associated with session that initiated the operation.
*
*
* The return value is a shared pointer to this operator.
*/
Operator::Ptr Operator::setMeshManager(smtk::mesh::ManagerPtr s)
{
this->m_meshmanager = s;
return shared_from_this();
}
/// Return the session associated with this operator (or a "null"/invalid shared-pointer).
Session* Operator::session() const
{
......
......@@ -164,6 +164,9 @@ public:
ManagerPtr manager() const;
Ptr setManager(ManagerPtr s);
smtk::mesh::ManagerPtr meshManager() const;
Ptr setMeshManager(smtk::mesh::ManagerPtr s);
Session* session() const;
Ptr setSession(Session* b);
......@@ -242,6 +245,7 @@ protected:
#ifndef SHIBOKEN_SKIP
ManagerPtr m_manager; // Model manager, not the attribute manager for the operator.
smtk::mesh::ManagerPtr m_meshmanager;
Session* m_session;
OperatorSpecification m_specification;
std::set<BareOperatorObserver> m_willOperateTriggers;
......
......@@ -21,6 +21,8 @@
#include "smtk/model/Instance.h"
#include "smtk/model/Group.h"
#include "smtk/mesh/Manager.h"
#include "smtk/attribute/Attribute.h"
#include "smtk/attribute/Definition.h"
#include "smtk/attribute/IntItemDefinition.h"
......@@ -42,7 +44,9 @@ namespace smtk {
/// Default constructor. This assigns a random session ID to each Session instance.
Session::Session()
: m_sessionId(smtk::common::UUID::random()), m_operatorSys(NULL)
: m_sessionId(smtk::common::UUID::random()),
m_operatorSys(NULL),
m_manager(NULL)
{
this->initializeOperatorSystem(Session::s_operators);
}
......@@ -166,6 +170,7 @@ OperatorPtr Session::op(const std::string& opName) const
oper->setSession(const_cast<Session*>(this));
oper->setManager(this->manager());
oper->setMeshManager(this->meshManager());
RemoteOperator::Ptr remoteOp = smtk::dynamic_pointer_cast<RemoteOperator>(oper);
if (remoteOp)
......@@ -244,6 +249,19 @@ Manager::Ptr Session::manager() const
Manager::Ptr();
}
/// Return a reference to the mesh manager for this Session.
smtk::mesh::ManagerPtr Session::meshManager() const
{
if(this->m_manager)
{
return this->m_manager->meshes();
}
else
{
return smtk::mesh::Manager::Ptr();
}
}
/// Return the log (obtained from the model manager).
smtk::io::Logger& Session::log()
{
......
......@@ -338,6 +338,7 @@ public:
virtual int setup(const std::string& optName, const StringList& optVal);
ManagerPtr manager() const;
smtk::mesh::ManagerPtr meshManager() const;
smtk::io::Logger& log();
protected:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment