Commit d40d5c25 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Added Lua bindings for DataContainer::getDataHandlesCopy() and extended...

Added Lua bindings for DataContainer::getDataHandlesCopy() and extended inspect.lua script with functionality to list the fields of SWIG objects.
parent 7a9d2a7f
......@@ -288,6 +288,21 @@ function inspect.inspect(rootObject, options)
return toReturn
end
local function gatherSwigGettersSetters(mt)
local toReturn = {}
local getters = mt[".get"]
if getters then
table.sort(getters, sortKeys)
for _,k in ipairs(getDictionaryKeys(getters)) do
table.insert(toReturn, k)
end
end
return toReturn
end
local function putSwigMetatable(v, path)
local mt = getmetatable(v)
local info = {}
......@@ -297,8 +312,12 @@ function inspect.inspect(rootObject, options)
table.sort(funcs, sortKeys)
tableAppearances[funcs] = 1
local gettersSetters = gatherSwigGettersSetters(mt)
tableAppearances[gettersSetters] = 1
info.ClassType = mt[".type"]
info.Methods = funcs
info.Fields = gettersSetters
puts('<',type(v),' ',getId(v),' ')
down(function()
......@@ -325,8 +344,9 @@ function inspect.inspect(rootObject, options)
puts('<',tv,' ',getId(v),'>')
else
putSwigMetatable(v, path)
--putTable(getmetatable(v), path)
end
-- putTable(getmetatable(v), path)
else
puts('<',tv,' ',getId(v),'>')
end
......
%module campvis
%include factory.i
%include std_pair.i
%include std_string.i
%include std_vector.i
%import "ext/cgt/bindings/cgt.i"
%include "ext/sigslot/sigslot.i"
%{
#include "core/datastructures/abstractdata.h"
#include "core/datastructures/imagedata.h"
......@@ -32,6 +37,9 @@ namespace sigslot {
%template(sigslot_signal1_AbstractProcessor) sigslot::signal1<campvis::AbstractProcessor*>;
%template(PairStringDataHandle) std::pair<std::string, campvis::DataHandle>;
%template(VectorOfPairStringDataHandle) std::vector< std::pair< std::string, campvis::DataHandle> >;
namespace campvis {
......@@ -286,6 +294,8 @@ namespace campvis {
void removeData(const std::string& name);
void clear();
std::vector< std::pair< std::string, DataHandle> > getDataHandlesCopy() const;
%immutable;
sigslot::signal0 s_changed;
%mutable;
......@@ -293,16 +303,16 @@ namespace campvis {
/* Downcast the return value of HasPropertyCollection::getProperty to appropriate subclass */
%factory(AbstractProperty* campvis::HasPropertyCollection::getProperty,
campvis::IntProperty, campvis::IVec2Property, campvis::IVec3Property, campvis::IVec4Property,
campvis::IntProperty, campvis::IVec2Property, campvis::IVec3Property, campvis::IVec4Property,
campvis::FloatProperty, campvis::Vec2Property, campvis::Vec3Property, campvis::Vec4Property,
campvis::TransferFunctionProperty,
campvis::TransferFunctionProperty,
campvis::DataNameProperty, campvis::StringProperty, campvis::ButtonProperty, campvis::BoolProperty);
/* Downcast the return value of HasPropertyCollection::getNestedProperty to appropriate subclass */
%factory(AbstractProperty* campvis::HasPropertyCollection::getNestedProperty,
campvis::IntProperty, campvis::IVec2Property, campvis::IVec3Property, campvis::IVec4Property,
campvis::IntProperty, campvis::IVec2Property, campvis::IVec3Property, campvis::IVec4Property,
campvis::FloatProperty, campvis::Vec2Property, campvis::Vec3Property, campvis::Vec4Property,
campvis::TransferFunctionProperty,
campvis::TransferFunctionProperty,
campvis::DataNameProperty, campvis::StringProperty, campvis::ButtonProperty, campvis::BoolProperty);
/* HasPropertyCollection */
......@@ -334,7 +344,7 @@ namespace campvis {
void addProperty(AbstractProperty& prop, int invalidationLevel);
void setPropertyInvalidationLevel(AbstractProperty& prop, int invalidationLevel);
void process(DataContainer& data);
void process(DataContainer& data);
%immutable;
sigslot::signal1<AbstractProcessor*> s_validated;
......@@ -353,8 +363,8 @@ namespace campvis {
const DataContainer& getDataContainer() const;
DataContainer& getDataContainer();
virtual void addProcessor(AbstractProcessor* processor);
virtual void executePipeline() = 0;
virtual void addProcessor(AbstractProcessor* processor);
virtual void executePipeline() = 0;
AbstractProcessor* getProcessor(const std::string& name) const;
};
......
Markdown is supported
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