GteProgramDefines.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
10 #include <GTEngineDEF.h>
11 #include <string>
12 #include <vector>
13 
14 // Construct definitions used by shader compilers.
15 
16 namespace gte
17 {
18 
20 {
21 public:
22  // Construction.
24 
25  // Set a definition. Each is stored as a std::pair of std::string. The
26  // firstelement of the pair is the 'name' and the second element of the
27  // pair is the string representation of 'value'.
28  inline void Set(std::string const& name, int value);
29  inline void Set(std::string const& name, unsigned int value);
30  inline void Set(std::string const& name, float value);
31  inline void Set(std::string const& name, double value);
32  inline void Set(std::string const& name, std::string const& value);
33  inline std::vector<std::pair<std::string,std::string>> const& Get() const;
34 
35  // Remove definitions, which allows the ProgramDefines object to be
36  // shared in a scope.
37  void Remove(std::string const& name);
38  void Clear();
39 
40 private:
41  void Update(std::string const& name, std::string const& value);
42 
43  std::vector<std::pair<std::string, std::string>> mDefinitions;
44 };
45 
46 
47 inline void ProgramDefines::Set(std::string const& name, int value)
48 {
49  Update(name, std::to_string(value));
50 }
51 
52 inline void ProgramDefines::Set(std::string const& name, unsigned int value)
53 {
54  Update(name, std::to_string(value));
55 }
56 
57 inline void ProgramDefines::Set(std::string const& name, float value)
58 {
59  Update(name, std::to_string(value));
60 }
61 
62 inline void ProgramDefines::Set(std::string const& name, double value)
63 {
64  Update(name, std::to_string(value));
65 }
66 
68  std::string const& value)
69 {
70  Update(name, value);
71 }
72 
73 inline std::vector<std::pair<std::string, std::string>> const&
75 {
76  return mDefinitions;
77 }
78 
79 
80 }
std::vector< std::pair< std::string, std::string > > const & Get() const
std::vector< std::pair< std::string, std::string > > mDefinitions
GLsizei const GLfloat * value
Definition: glcorearb.h:819
GLuint const GLchar * name
Definition: glcorearb.h:781
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
void Set(std::string const &name, int value)
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:01