[opengtl-commits] [739] add min/max/unit nodes for channel

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 739
Author:   cyrille
Date:     2009-05-26 15:06:15 +0200 (Tue, 26 May 2009)

Log Message:
-----------
add min/max/unit nodes for channel

Modified Paths:
--------------
    trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/GenerationContext_p.cpp
    trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/GenerationContext_p.h
    trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST.cpp
    trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST_p.h


Modified: trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/GenerationContext_p.cpp
===================================================================
--- trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/GenerationContext_p.cpp	2009-05-26 13:01:01 UTC (rev 738)
+++ trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/GenerationContext_p.cpp	2009-05-26 13:06:15 UTC (rev 739)
@@ -85,3 +85,7 @@
   GTL_ASSERT(m_isLocalContext);
   return m_currentChannel;
 }
+
+const GTLCore::Type* TemplateGenerationContext::currentChannelType() const {
+  return pixelDescription().channelTypes()[currentChannelType()];
+}

Modified: trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/GenerationContext_p.h
===================================================================
--- trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/GenerationContext_p.h	2009-05-26 13:01:01 UTC (rev 738)
+++ trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/GenerationContext_p.h	2009-05-26 13:06:15 UTC (rev 739)
@@ -37,6 +37,7 @@
       bool isAllreadyRegistered( const GTLCore::String& variable);
       const GTLCore::String& suffix();
       int currentChannel();
+      const GTLCore::Type* currentChannelType() const;
     private:
       GTLCore::String m_code;
       GTLCore::String m_forward;

Modified: trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST.cpp
===================================================================
--- trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST.cpp	2009-05-26 13:01:01 UTC (rev 738)
+++ trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST.cpp	2009-05-26 13:06:15 UTC (rev 739)
@@ -229,7 +229,19 @@
   if(not _context->isAllreadyRegistered(realname))
   {
     _context->registerVariable(realname);
-    _context->appendForward( typeToString(_context->pixelDescription().channelTypes()[_context->currentChannel()]) + " " + realname + ";" );
+    _context->appendForward( typeToString(_context->currentChannelType()) + " " + realname + ";" );
   }
   _context->append(realname);
 }
+
+void ChannelMaxNode::generate(TemplateGenerationContext* _context) {
+  _context->append(typeMax(_context->currentChannelType()));
+}
+
+void ChannelMinNode::generate(TemplateGenerationContext* _context) {
+  _context->append(typeMin(_context->currentChannelType()));
+}
+
+void ChannelUnitNode::generate(TemplateGenerationContext* _context) {
+  _context->append(typeUnit(_context->currentChannelType()));
+}

Modified: trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST_p.h
===================================================================
--- trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST_p.h	2009-05-26 13:01:01 UTC (rev 738)
+++ trunk/OpenGTL/OpenCTL/OpenCTL/templatecompiler/TemplateAST_p.h	2009-05-26 13:06:15 UTC (rev 739)
@@ -105,15 +105,15 @@
       private:
         GTLCore::String m_name;
     };
-    class MaxNode : public Node {
+    class ChannelMaxNode : public Node {
       public:
         virtual void generate(TemplateGenerationContext* _context);
     };
-    class MinNode : public Node {
+    class ChannelMinNode : public Node {
       public:
         virtual void generate(TemplateGenerationContext* _context);
     };
-    class UnitNode : public Node {
+    class ChannelUnitNode : public Node {
       public:
         virtual void generate(TemplateGenerationContext* _context);
     };


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/