24 #ifndef __LAYOUT_LOADER_MODULES_INCLUDE__
25 #define __LAYOUT_LOADER_MODULES_INCLUDE__
38 using namespace CoreGL;
39 using namespace CorePipeline;
749 const std::string name;
750 std::string description,
752 std::vector<std::pair<std::string,std::string> > argumentsDescriptions;
753 const int minNumArguments,
755 const char bodyPresence;
757 void initManual(
const std::string& _manual);
760 LayoutLoaderModule(
const std::string& _name,
const std::string& _manual,
const int& _minNumArguments,
const int& _maxNumArguments,
const char& _bodyPresence);
802 virtual void apply(
const std::vector<std::string>& arguments,
803 const std::string& body,
804 const std::string& currentPath,
805 std::vector<std::string>& dynamicPaths,
806 std::map<std::string, HdlTextureFormat>& formatList,
807 std::map<std::string, ShaderSource>& sourceList,
808 std::map<std::string, GeometryModel>& geometryList,
809 std::map<std::string, FilterLayout>& filterList,
810 std::map<std::string, PipelineLayout>& pipelineList,
811 std::string& mainPipelineName,
812 const std::vector<std::string>& staticPaths,
813 const std::map<std::string, HdlTextureFormat>& requiredFormatList,
814 const std::map<std::string, ShaderSource>& requiredSourceList,
815 const std::map<std::string, GeometryModel>& requiredGeometryList,
816 const std::map<std::string, PipelineLayout>& requiredPipelineList,
817 const std::map<std::string, LayoutLoaderModule*>& moduleList,
818 const std::string& sourceName,
821 std::string& executionSource,
822 std::string& executionSourceName,
823 int& executionStartLine) = 0;
825 const std::string& getName(
void)
const;
826 const int& getMinNumArguments(
void)
const;
827 const int& getMaxNumArguments(
void)
const;
828 const char& bodyPresenceTest(
void)
const;
829 const std::string& getDescription(
void)
const;
830 const std::string& getBodyDescription(
void)
const;
831 const std::vector<std::pair<std::string,std::string> >& getArgumentsDescriptions(
void)
const;
832 std::string getManual(
void)
const;
835 virtual void beginLoadLayout(
void);
836 virtual void endLoadLayout(
void);
840 static std::vector<LayoutLoaderModule*> getBasicModulesList(
void);
841 static bool getBoolean(
const std::string& arg,
const std::string& sourceName=
"",
int line=1);
842 static void getCases(
const std::string& body, std::string& trueCase,
int& trueCaseStartLine, std::string& falseCase,
int& falseCaseStartLine,
const std::string& sourceName=
"",
int bodyLine=1);
843 static std::vector<std::string> findFile(
const std::string& filename,
const std::vector<std::string>& dynamicPaths);
848 #define LAYOUT_LOADER_ARGUMENTS_LIST const std::vector<std::string>& arguments, \
849 const std::string& body, \
850 const std::string& currentPath, \
851 std::vector<std::string>& dynamicPaths, \
852 std::map<std::string, Glip::CoreGL::HdlTextureFormat>& formatList, \
853 std::map<std::string, Glip::CoreGL::ShaderSource>& sourceList, \
854 std::map<std::string, Glip::CorePipeline::GeometryModel>& geometryList, \
855 std::map<std::string, Glip::CorePipeline::FilterLayout>& filterList, \
856 std::map<std::string, Glip::CorePipeline::PipelineLayout>& pipelineList, \
857 std::string& mainPipelineName, \
858 const std::vector<std::string>& staticPaths, \
859 const std::map<std::string, Glip::CoreGL::HdlTextureFormat>& requiredFormatList, \
860 const std::map<std::string, Glip::CoreGL::ShaderSource>& requiredSourceList, \
861 const std::map<std::string, Glip::CorePipeline::GeometryModel>& requiredGeometryList, \
862 const std::map<std::string, Glip::CorePipeline::PipelineLayout>& requiredPipelineList, \
863 const std::map<std::string, Glip::Modules::LayoutLoaderModule*>& moduleList, \
864 const std::string& sourceName, \
865 const int startLine, \
866 const int bodyLine, \
867 std::string& executionSource, \
868 std::string& executionSourceName, \
869 int& executionStartLine
872 #define LAYOUT_LOADER_MODULE_DEFINITION( name ) class name : public Glip::Modules::LayoutLoaderModule \
877 void apply(LAYOUT_LOADER_ARGUMENTS_LIST); \
881 #define LAYOUT_LOADER_MODULE_APPLY( moduleName, minArgs, maxArgs, bodyPresence, moduleManual) \
882 moduleName :: moduleName (void) : Glip::Modules::LayoutLoaderModule( #moduleName, moduleManual, minArgs, maxArgs, bodyPresence) { } \
883 void moduleName :: apply(LAYOUT_LOADER_ARGUMENTS_LIST)
886 #define __ITERATOR_FIND(type, varName, iteratorName, elementName) std::map<std::string, type >::iterator iteratorName = varName.find( elementName );
887 #define __CONST_ITERATOR_FIND(type, varName, iteratorName, elementName) std::map<std::string, type >::const_iterator iteratorName = varName.find( elementName );
888 #define __ELEMENT_MUST_BE_IN(iteratorName, varName, elementName) { if(iteratorName==varName.end()) throw Exception("Element \"" + elementName + "\" was not found in \"" + #varName + "\".", sourceName, startLine, Exception::ClientScriptException); }
889 #define __ELEMENT_MUST_NOT_BE_IN(iteratorName, varName, elementName) { if(iteratorName!=varName.end()) throw Exception("Element \"" + elementName + "\" already exists in \"" + #varName + "\".", sourceName, startLine, Exception::ClientScriptException); }
890 #define __APPEND_NEW_ELEMENT(type, varName, elementName, element) varName.insert( std::pair<std::string, type>( elementName, element ) );
893 #define ITERATOR_TO_FORMAT( iteratorName, elementName ) __ITERATOR_FIND(Glip::CoreGL::HdlTextureFormat, formatList, iteratorName, elementName)
895 #define CONST_ITERATOR_TO_FORMAT( iteratorName, elementName ) __CONST_ITERATOR_FIND(Glip::CoreGL::HdlTextureFormat, formatList, iteratorName, elementName)
897 #define VALID_ITERATOR_TO_FORMAT( iteratorName ) ( iteratorName != formatList.end() )
899 #define FORMAT_MUST_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CoreGL::HdlTextureFormat, formatList, iteratorName, elementName) __ELEMENT_MUST_BE_IN(iteratorName, formatList, elementName) }
901 #define FORMAT_MUST_NOT_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CoreGL::HdlTextureFormat, formatList, iteratorName, elementName) __ELEMENT_MUST_NOT_BE_IN(iteratorName, formatList, elementName) }
903 #define APPEND_NEW_FORMAT(elementName, newElement) __APPEND_NEW_ELEMENT(Glip::CoreGL::HdlTextureFormat, formatList, elementName, newElement)
906 #define ITERATOR_TO_SOURCE( iteratorName, elementName ) __ITERATOR_FIND(Glip::CoreGL::ShaderSource, sourceList, iteratorName, elementName)
908 #define CONST_ITERATOR_TO_SOURCE( iteratorName, elementName ) __CONST_ITERATOR_FIND(Glip::CoreGL::ShaderSource, sourceList, iteratorName, elementName)
910 #define VALID_ITERATOR_TO_SOURCE( iteratorName ) ( iteratorName != sourceList.end() )
912 #define SOURCE_MUST_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CoreGL::ShaderSource, sourceList, iteratorName, elementName) __ELEMENT_MUST_BE_IN(iteratorName, sourceList, elementName) }
914 #define SOURCE_MUST_NOT_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CoreGL::ShaderSource, sourceList, iteratorName, elementName) __ELEMENT_MUST_NOT_BE_IN(iteratorName, sourceList, elementName) }
916 #define APPEND_NEW_SOURCE(elementName, newElement) __APPEND_NEW_ELEMENT(Glip::CoreGL::ShaderSource, sourceList, elementName, newElement)
919 #define ITERATOR_TO_GEOMETRY( iteratorName, elementName ) __ITERATOR_FIND(Glip::CorePipeline::GeometryModel, geometryList, iteratorName, elementName)
921 #define CONST_ITERATOR_TO_GEOMETRY( iteratorName, elementName ) __CONST_ITERATOR_FIND(Glip::CorePipeline::GeometryModel, geometryList, iteratorName, elementName)
923 #define VALID_ITERATOR_TO_GEOMETRY( iteratorName ) ( iteratorName != geometryList.end() )
925 #define GEOMETRY_MUST_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CorePipelin::GeometryModel, geometryList, iteratorName, elementName) __ELEMENT_MUST_BE_IN(iteratorName, geometryList, elementName) }
927 #define GEOMETRY_MUST_NOT_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CorePipeline::GeometryModel, geometryList, iteratorName, elementName) __ELEMENT_MUST_NOT_BE_IN(iteratorName, geometryList, elementName) }
929 #define APPEND_NEW_GEOMETRY(elementName, newElement) __APPEND_NEW_ELEMENT(Glip::CorePipeline::GeometryModel, geometryList, elementName, newElement)
932 #define ITERATOR_TO_FILTER( iteratorName, elementName ) __ITERATOR_FIND(Glip::CorePipeline::FilterLayout, filterList, iteratorName, elementName)
934 #define CONST_ITERATOR_TO_FILTER( iteratorName, elementName ) __CONST_ITERATOR_FIND(Glip::CorePipeline::FilterLayout, filterList, iteratorName, elementName)
936 #define VALID_ITERATOR_TO_FILTER( iteratorName ) ( iteratorName != filterList.end() )
938 #define FILTER_MUST_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CorePipeline::FilterLayout, filterList, iteratorName, elementName) __ELEMENT_MUST_BE_IN(iteratorName, filterList, elementName) }
940 #define FILTER_MUST_NOT_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CorePipeline::FilterLayout, filterList, iteratorName, elementName) __ELEMENT_MUST_NOT_BE_IN(iteratorName, filterList, elementName) }
942 #define APPEND_NEW_FILTER(elementName, newElement) __APPEND_NEW_ELEMENT(Glip::CorePipeline::FilterLayout, filterList, elementName, newElement)
945 #define ITERATOR_TO_PIPELINE( iteratorName, elementName ) __ITERATOR_FIND(Glip::CorePipeline::PipelineLayout, pipelineList, iteratorName, elementName)
947 #define CONST_ITERATOR_TO_PIPELINE( iteratorName, elementName ) __CONST_ITERATOR_FIND(Glip::CorePipeline::PipelineLayout, pipelineList, iteratorName, elementName)
949 #define VALID_ITERATOR_TO_PIPELINE( iteratorName ) ( iteratorName != pipelineList.end() )
951 #define PIPELINE_MUST_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CorePipeline::PipelineLayout, pipelineList, iteratorName, elementName) __ELEMENT_MUST_BE_IN(iteratorName, pipelineList, elementName) }
953 #define PIPELINE_MUST_NOT_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CorePipeline::PipelineLayout, pipelineList, iteratorName, elementName) __ELEMENT_MUST_NOT_BE_IN(iteratorName, pipelineList, elementName) }
955 #define APPEND_NEW_PIPELINE(elementName, newElement) __APPEND_NEW_ELEMENT(Glip::CorePipeline::PipelineLayout, pipelineList, elementName, newElement)
958 #define CONST_ITERATOR_TO_REQUIREDFORMAT( iteratorName, elementName ) __CONST_ITERATOR_FIND(Glip::CoreGL::HdlTextureFormat, requiredFormatList, iteratorName, elementName)
960 #define VALID_ITERATOR_TO_REQUIREDFORMAT( iteratorName ) ( iteratorName != requiredFormatList.end() )
962 #define REQUIREDFORMAT_MUST_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CoreGL::HdlTextureFormat, requiredFormatList, iteratorName, elementName) __ELEMENT_MUST_BE_IN(iteratorName, requiredFormatList, elementName) }
964 #define REQUIREDFORMAT_MUST_NOT_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CoreGL::HdlTextureFormat, requiredFormatList, iteratorName, elementName) __ELEMENT_MUST_NOT_BE_IN(iteratorName, requiredFormatList, elementName) }
967 #define CONST_ITERATOR_TO_REQUIREDSOURCE( iteratorName, elementName ) __CONST_ITERATOR_FIND(Glip::CoreGL::ShaderSource, requiredSourceList, iteratorName, elementName)
969 #define VALID_ITERATOR_TO_REQUIREDSOURCE( iteratorName ) ( iteratorName != requiredSourceList.end() )
971 #define REQUIREDSOURCE_MUST_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CoreGL::ShaderSource, requiredSourceList, iteratorName, elementName) __ELEMENT_MUST_BE_IN(iteratorName, requiredSourceList, elementName) }
973 #define REQUIREDSOURCE_MUST_NOT_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CoreGL::ShaderSource, requiredSourceList, iteratorName, elementName) __ELEMENT_MUST_NOT_BE_IN(iteratorName, requiredSourceList, elementName) }
976 #define CONST_ITERATOR_TO_REQUIREDGEOMETRY( iteratorName, elementName ) __CONST_ITERATOR_FIND(Glip::CorePipeline::GeometryModel, requiredGeometryList, iteratorName, elementName)
978 #define VALID_ITERATOR_TO_REQUIREDGEOMETRY( iteratorName ) ( iteratorName != requiredGeometryList.end() )
980 #define REQUIREDGEOMETRY_MUST_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CorePipeline::GeometryModel, requiredGeometryList, iteratorName, elementName) __ELEMENT_MUST_BE_IN(iteratorName, requiredGeometryList, elementName) }
982 #define REQUIREDGEOMETRY_MUST_NOT_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CorePipeline::GeometryModel, requiredGeometryList, iteratorName, elementName) __ELEMENT_MUST_NOT_BE_IN(iteratorName, requiredGeometryList, elementName) }
985 #define CONST_ITERATOR_TO_REQUIREDPIPELINE( iteratorName, elementName ) __CONST_ITERATOR_FIND(Glip::CorePipeline::PipelineLayout, requiredPipelineList, iteratorName, elementName)
987 #define VALID_ITERATOR_TO_REQUIREDPIPELINE( iteratorName ) ( iteratorName != requiredPipelineList.end() )
989 #define REQUIREDPIPELINE_MUST_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CorePipeline::PipelineLayout, requiredPipelineList, iteratorName, elementName) __ELEMENT_MUST_BE_IN(iteratorName, requirePipelineList, elementName) }
991 #define REQUIREDPIPELINE_MUST_NOT_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::CorePipeline::PipelineLayout, requiredPipelineList, iteratorName, elementName) __ELEMENT_MUST_NOT_BE_IN(iteratorName, requiredPipelineList, elementName) }
994 #define CONST_ITERATOR_TO_MODULE( iteratorName, elementName ) __CONST_ITERATOR_FIND(Glip::Modules::LayoutLoaderModule*, moduleList, iteratorName, elementName)
996 #define VALID_ITERATOR_TO_MODULE( iteratorName ) ( iteratorName != moduleList.end() )
998 #define MODULE_MUST_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::Modules::LayoutLoaderModule*, moduleList, iteratorName, elementName) __ELEMENT_MUST_BE_IN(iteratorName, moduleList, elementName) }
1000 #define MODULE_MUST_NOT_EXIST( elementName ) { __CONST_ITERATOR_FIND(Glip::Modules::LayoutLoaderModule*, moduleList, iteratorName, elementName) __ELEMENT_MUST_NOT_BE_IN(iteratorName, moduleList, elementName) }
1004 #define CAST_ARGUMENT( argID, type, varName ) type varName; if(!fromString(arguments[ argID ], varName)) throw Exception("Unable to cast argument " + toString( argID ) + " (\"" + arguments[argID] + "\") to " + #type + ".", sourceName, startLine, Exception::ClientScriptException);
Module description for the LayoutLoader class.
Definition: LayoutLoaderModules.hpp:746
Definition: Component.hpp:32
Geometry objects and memory management.
#define LAYOUT_LOADER_MODULE_DEFINITION(name)
Definition: LayoutLoaderModules.hpp:872
Load and save pipelines layouts to file.
Definition: LayoutLoader.hpp:706