Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

KoduPrimitive.h

Go to the documentation of this file.
00001 #ifndef KODU_PRIMITIVE_H_
00002 #define KODU_PRIMITIVE_H_
00003 
00004 // Tekkodu Library
00005 #include "Kodu/General/GeneralMacros.h"
00006 
00007 // C++ Library
00008 #include <iostream>
00009 #include <string>
00010 
00011 namespace Kodu {
00012     
00013     //! Kodu Primitive
00014     class KoduPrimitive {   
00015     public:
00016         //! Constructor
00017         KoduPrimitive(const std::string& kPrimitiveType)
00018           : primitiveType(kPrimitiveType),
00019             agentCanUseThisPrimitive(true)
00020         { }
00021         
00022         //! Copy constructor
00023         KoduPrimitive(const KoduPrimitive& kPrimitive)
00024           : primitiveType(kPrimitive.primitiveType),
00025             agentCanUseThisPrimitive(kPrimitive.agentCanUseThisPrimitive)
00026         { }
00027 
00028         //! Destructor
00029         virtual ~KoduPrimitive() {
00030             // no explicit implementation
00031         }
00032         
00033         //! Assignment operator
00034         KoduPrimitive& operator=(const KoduPrimitive& kPrimitive) {
00035             if (this != &kPrimitive) {
00036                 primitiveType = kPrimitive.primitiveType;
00037                 agentCanUseThisPrimitive = kPrimitive.agentCanUseThisPrimitive;
00038             }
00039             return *this;
00040         }
00041 
00042         //! Returns the name of the derived primitive
00043         const std::string& getPrimitiveType() const {
00044             return primitiveType;
00045         }
00046         
00047         //! Tests if the primitive argument is the same as the calling class
00048         static bool isSameTypeAs(const KoduPrimitive*);
00049 
00050         //! Used to reinitialize certain variables (e.g. when switching to another page)
00051         virtual void reinitialize() {
00052             agentCanUseThisPrimitive = true;
00053         }
00054 
00055         //! Prints the attributes for a particular primitive (pure virtual function)
00056         virtual void printAttrs() const {
00057             std::cout << "Primitive Type: " << primitiveType << std::endl;
00058             PRINT_ATTRS("Agent can use primitive", agentCanUseThisPrimitive);
00059         }
00060 
00061         bool agentCanUsePrimitive() const {
00062             return agentCanUseThisPrimitive;
00063         }
00064 
00065         void setAgentCanUsePrimitive(bool bval) {
00066             agentCanUseThisPrimitive = bval;
00067         }
00068 
00069     protected:
00070         std::string primitiveType;  //!< The name of the derived primitive
00071         bool agentCanUseThisPrimitive;
00072     };
00073 } // end of Kodu namespace
00074 
00075 #endif // KODU_PRIMITIVE_H_

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:43 2016 by Doxygen 1.6.3