diff --git a/externals/otf/otf_vc08.sln b/externals/otf/otf_vc08.sln index 81363dba968778e971235f48294e8482c4b4d62c..0d89b754568b98076c87c84759ca70b96ec8de29 100644 --- a/externals/otf/otf_vc08.sln +++ b/externals/otf/otf_vc08.sln @@ -1,66 +1,66 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libotf", "otflib\libotf_vs08.vcproj", "{6B9B49C9-75CD-400D-B736-5EACA04D0A82}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfaux", "tools\otfaux\otfaux_vs08.vcproj", "{24587836-ED5E-49DF-A7AD-419FDC208C08}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfcompress", "tools\otfcompress\otfcompress_vs08.vcproj", "{B6BBC220-1492-4BEA-A299-9D062133ABAA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfdump", "tools\otfdump\otfdump_vs08.vcproj", "{508A823C-8EAB-4C56-9DFE-4D85B0D24491}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfmerge", "tools\otfmerge\otfmerge_vs08.vcproj", "{1B9223C8-DE20-4538-8214-776C6017D22B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release Static|Win32 = Release Static|Win32 - Release Static|x64 = Release Static|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|Win32.ActiveCfg = Debug|Win32 - {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|Win32.Build.0 = Debug|Win32 - {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|x64.ActiveCfg = Debug|x64 - {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|x64.Build.0 = Debug|x64 - {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|Win32.ActiveCfg = Release Static|Win32 - {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|Win32.Build.0 = Release Static|Win32 - {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|x64.ActiveCfg = Release Static|x64 - {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|x64.Build.0 = Release Static|x64 - {24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|Win32.ActiveCfg = Debug|Win32 - {24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|Win32.Build.0 = Debug|Win32 - {24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|x64.ActiveCfg = Debug|x64 - {24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|x64.Build.0 = Debug|x64 - {24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|Win32.ActiveCfg = Release Static|Win32 - {24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|Win32.Build.0 = Release Static|Win32 - {24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|x64.ActiveCfg = Release Static|x64 - {24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|x64.Build.0 = Release Static|x64 - {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|Win32.ActiveCfg = Debug|Win32 - {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|Win32.Build.0 = Debug|Win32 - {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|x64.ActiveCfg = Debug|x64 - {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|x64.Build.0 = Debug|x64 - {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|Win32.ActiveCfg = Release Static|Win32 - {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|Win32.Build.0 = Release Static|Win32 - {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|x64.ActiveCfg = Release Static|x64 - {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|x64.Build.0 = Release Static|x64 - {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|Win32.ActiveCfg = Debug|Win32 - {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|Win32.Build.0 = Debug|Win32 - {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|x64.ActiveCfg = Debug|x64 - {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|x64.Build.0 = Debug|x64 - {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|Win32.ActiveCfg = Release Static|Win32 - {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|Win32.Build.0 = Release Static|Win32 - {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|x64.ActiveCfg = Release Static|x64 - {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|x64.Build.0 = Release Static|x64 - {1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|Win32.ActiveCfg = Debug|Win32 - {1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|Win32.Build.0 = Debug|Win32 - {1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|x64.ActiveCfg = Debug|x64 - {1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|x64.Build.0 = Debug|x64 - {1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|Win32.ActiveCfg = Release Static|Win32 - {1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|Win32.Build.0 = Release Static|Win32 - {1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|x64.ActiveCfg = Release Static|x64 - {1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|x64.Build.0 = Release Static|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libotf", "otflib\libotf_vs08.vcproj", "{6B9B49C9-75CD-400D-B736-5EACA04D0A82}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfaux", "tools\otfaux\otfaux_vs08.vcproj", "{24587836-ED5E-49DF-A7AD-419FDC208C08}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfcompress", "tools\otfcompress\otfcompress_vs08.vcproj", "{B6BBC220-1492-4BEA-A299-9D062133ABAA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfdump", "tools\otfdump\otfdump_vs08.vcproj", "{508A823C-8EAB-4C56-9DFE-4D85B0D24491}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "otfmerge", "tools\otfmerge\otfmerge_vs08.vcproj", "{1B9223C8-DE20-4538-8214-776C6017D22B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release Static|Win32 = Release Static|Win32 + Release Static|x64 = Release Static|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|Win32.ActiveCfg = Debug|Win32 + {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|Win32.Build.0 = Debug|Win32 + {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|x64.ActiveCfg = Debug|x64 + {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Debug|x64.Build.0 = Debug|x64 + {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|Win32.ActiveCfg = Release Static|Win32 + {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|Win32.Build.0 = Release Static|Win32 + {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|x64.ActiveCfg = Release Static|x64 + {6B9B49C9-75CD-400D-B736-5EACA04D0A82}.Release Static|x64.Build.0 = Release Static|x64 + {24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|Win32.ActiveCfg = Debug|Win32 + {24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|Win32.Build.0 = Debug|Win32 + {24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|x64.ActiveCfg = Debug|x64 + {24587836-ED5E-49DF-A7AD-419FDC208C08}.Debug|x64.Build.0 = Debug|x64 + {24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|Win32.ActiveCfg = Release Static|Win32 + {24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|Win32.Build.0 = Release Static|Win32 + {24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|x64.ActiveCfg = Release Static|x64 + {24587836-ED5E-49DF-A7AD-419FDC208C08}.Release Static|x64.Build.0 = Release Static|x64 + {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|Win32.ActiveCfg = Debug|Win32 + {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|Win32.Build.0 = Debug|Win32 + {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|x64.ActiveCfg = Debug|x64 + {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Debug|x64.Build.0 = Debug|x64 + {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|Win32.ActiveCfg = Release Static|Win32 + {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|Win32.Build.0 = Release Static|Win32 + {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|x64.ActiveCfg = Release Static|x64 + {B6BBC220-1492-4BEA-A299-9D062133ABAA}.Release Static|x64.Build.0 = Release Static|x64 + {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|Win32.ActiveCfg = Debug|Win32 + {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|Win32.Build.0 = Debug|Win32 + {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|x64.ActiveCfg = Debug|x64 + {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Debug|x64.Build.0 = Debug|x64 + {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|Win32.ActiveCfg = Release Static|Win32 + {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|Win32.Build.0 = Release Static|Win32 + {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|x64.ActiveCfg = Release Static|x64 + {508A823C-8EAB-4C56-9DFE-4D85B0D24491}.Release Static|x64.Build.0 = Release Static|x64 + {1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|Win32.ActiveCfg = Debug|Win32 + {1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|Win32.Build.0 = Debug|Win32 + {1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|x64.ActiveCfg = Debug|x64 + {1B9223C8-DE20-4538-8214-776C6017D22B}.Debug|x64.Build.0 = Debug|x64 + {1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|Win32.ActiveCfg = Release Static|Win32 + {1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|Win32.Build.0 = Release Static|Win32 + {1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|x64.ActiveCfg = Release Static|x64 + {1B9223C8-DE20-4538-8214-776C6017D22B}.Release Static|x64.Build.0 = Release Static|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/interface/interval_select.ui b/src/interface/interval_select.ui index e238095981526ba79fa04d0f673b50b55a0b4ea5..98afb810eaee8fc8796128f1ba1e91907da976fa 100644 --- a/src/interface/interval_select.ui +++ b/src/interface/interval_select.ui @@ -1,226 +1,226 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>interval_selector</class> - <widget class="QDialog" name="interval_selector"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>522</width> - <height>283</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>522</width> - <height>283</height> - </size> - </property> - <property name="windowTitle"> - <string>Interval Selection</string> - </property> - <widget class="QxtSpanSlider" name="interval_slider"> - <property name="geometry"> - <rect> - <x>60</x> - <y>140</y> - <width>401</width> - <height>20</height> - </rect> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - <widget class="QDoubleSpinBox" name="minSpinBox"> - <property name="geometry"> - <rect> - <x>80</x> - <y>80</y> - <width>151</width> - <height>22</height> - </rect> - </property> - </widget> - <widget class="QDoubleSpinBox" name="maxSpinBox"> - <property name="geometry"> - <rect> - <x>300</x> - <y>80</y> - <width>151</width> - <height>22</height> - </rect> - </property> - </widget> - <widget class="QLabel" name="label"> - <property name="geometry"> - <rect> - <x>30</x> - <y>140</y> - <width>21</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>Min</string> - </property> - </widget> - <widget class="QLabel" name="label_2"> - <property name="geometry"> - <rect> - <x>470</x> - <y>140</y> - <width>31</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>Max</string> - </property> - </widget> - <widget class="QLabel" name="min_value"> - <property name="geometry"> - <rect> - <x>0</x> - <y>160</y> - <width>131</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>0</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - <widget class="QLabel" name="max_value"> - <property name="geometry"> - <rect> - <x>390</x> - <y>160</y> - <width>121</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>0</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - <widget class="QLabel" name="label_5"> - <property name="geometry"> - <rect> - <x>100</x> - <y>60</y> - <width>121</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>New min value :</string> - </property> - </widget> - <widget class="QLabel" name="label_6"> - <property name="geometry"> - <rect> - <x>320</x> - <y>60</y> - <width>111</width> - <height>16</height> - </rect> - </property> - <property name="text"> - <string>New max value :</string> - </property> - </widget> - <widget class="QPushButton" name="ok_button"> - <property name="geometry"> - <rect> - <x>300</x> - <y>240</y> - <width>75</width> - <height>23</height> - </rect> - </property> - <property name="text"> - <string>OK</string> - </property> - </widget> - <widget class="QPushButton" name="cancel_button"> - <property name="geometry"> - <rect> - <x>390</x> - <y>240</y> - <width>75</width> - <height>23</height> - </rect> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - <widget class="QPushButton" name="reset_button"> - <property name="geometry"> - <rect> - <x>120</x> - <y>240</y> - <width>75</width> - <height>23</height> - </rect> - </property> - <property name="text"> - <string>Reset</string> - </property> - </widget> - <widget class="QPushButton" name="apply_button"> - <property name="geometry"> - <rect> - <x>210</x> - <y>240</y> - <width>75</width> - <height>23</height> - </rect> - </property> - <property name="text"> - <string>Apply</string> - </property> - </widget> - <widget class="QCheckBox" name="auto_refresh_box"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="geometry"> - <rect> - <x>250</x> - <y>190</y> - <width>241</width> - <height>17</height> - </rect> - </property> - <property name="text"> - <string>Auto Refresh (disable if slow)</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </widget> - <customwidgets> - <customwidget> - <class>QxtSpanSlider</class> - <extends>QSlider</extends> - <header>interface/qxtspanslider.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> +<class>interval_selector</class> +<widget class="QDialog" name="interval_selector"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>522</width> + <height>283</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>522</width> + <height>283</height> + </size> + </property> + <property name="windowTitle"> + <string>Interval Selection</string> + </property> + <widget class="QxtSpanSlider" name="interval_slider"> + <property name="geometry"> + <rect> + <x>60</x> + <y>140</y> + <width>401</width> + <height>20</height> + </rect> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + <widget class="QDoubleSpinBox" name="minSpinBox"> + <property name="geometry"> + <rect> + <x>80</x> + <y>80</y> + <width>151</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QDoubleSpinBox" name="maxSpinBox"> + <property name="geometry"> + <rect> + <x>300</x> + <y>80</y> + <width>151</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="label"> + <property name="geometry"> + <rect> + <x>30</x> + <y>140</y> + <width>21</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Min</string> + </property> + </widget> + <widget class="QLabel" name="label_2"> + <property name="geometry"> + <rect> + <x>470</x> + <y>140</y> + <width>31</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Max</string> + </property> + </widget> + <widget class="QLabel" name="min_value"> + <property name="geometry"> + <rect> + <x>0</x> + <y>160</y> + <width>131</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>0</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + <widget class="QLabel" name="max_value"> + <property name="geometry"> + <rect> + <x>390</x> + <y>160</y> + <width>121</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>0</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + <widget class="QLabel" name="label_5"> + <property name="geometry"> + <rect> + <x>100</x> + <y>60</y> + <width>121</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>New min value :</string> + </property> + </widget> + <widget class="QLabel" name="label_6"> + <property name="geometry"> + <rect> + <x>320</x> + <y>60</y> + <width>111</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>New max value :</string> + </property> + </widget> + <widget class="QPushButton" name="ok_button"> + <property name="geometry"> + <rect> + <x>300</x> + <y>240</y> + <width>75</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>OK</string> + </property> + </widget> + <widget class="QPushButton" name="cancel_button"> + <property name="geometry"> + <rect> + <x>390</x> + <y>240</y> + <width>75</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + <widget class="QPushButton" name="reset_button"> + <property name="geometry"> + <rect> + <x>120</x> + <y>240</y> + <width>75</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>Reset</string> + </property> + </widget> + <widget class="QPushButton" name="apply_button"> + <property name="geometry"> + <rect> + <x>210</x> + <y>240</y> + <width>75</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>Apply</string> + </property> + </widget> + <widget class="QCheckBox" name="auto_refresh_box"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="geometry"> + <rect> + <x>250</x> + <y>190</y> + <width>241</width> + <height>17</height> + </rect> + </property> + <property name="text"> + <string>Auto Refresh (disable if slow)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> +</widget> +<customwidgets> + <customwidget> + <class>QxtSpanSlider</class> + <extends>QSlider</extends> + <header>interface/qxtspanslider.h</header> + </customwidget> +</customwidgets> +<resources/> +<connections/> +</ui> diff --git a/src/render/Shader.hpp b/src/render/Shader.hpp index 9b2af210b7d301adaafc02e5d616a1dbc1cfe94a..daaf04caa9564ea18011cc8dff56faeb9b0cd57f 100644 --- a/src/render/Shader.hpp +++ b/src/render/Shader.hpp @@ -1,54 +1,54 @@ -#ifndef DEF_SHADER -#define DEF_SHADER -//#include <GL/glew.h> - - -#include "common/common.hpp" -// Includes communs - -#include <iostream> -#include <string> -#include <fstream> -// Classe Shader - -class Shader -{ - public: -/* Default constructor*/ - Shader(); - -/*Constructor for shaders using textures. Parameter n is not used, it just allow to create a have another constructor. */ - Shader(int glsl, int n); - -/* Construct a Shader reading colors in the VBO. Still used for containers and selection*/ - Shader(int glsl); - -/* Construct Shaders we use for entities - param glsl says which version of GL Shading Language we are using - param rgb define the color - param shade should be true for states, false either*/ - Shader(int glsl, Element_col, Element_col, Element_col, bool); - - //Destructor - ~Shader(); - - Shader& operator=(Shader const &shaderACopier); - - /*Loading function*/ - bool charger(); - /*Compilation function*/ - bool compilerShader(GLuint &shader, GLenum type, const std::string &code); - /*Getter*/ - GLuint getProgramID() const; - - private: - - GLuint m_vertexID {0}; - GLuint m_fragmentID {0}; - GLuint m_programID {0}; - - std::string m_vertex_code; - std::string m_fragment_code; -}; - -#endif +#ifndef DEF_SHADER +#define DEF_SHADER +//#include <GL/glew.h> + + +#include "common/common.hpp" +// Includes communs + +#include <iostream> +#include <string> +#include <fstream> +// Classe Shader + +class Shader +{ +public: + /* Default constructor*/ + Shader(); + + /*Constructor for shaders using textures. Parameter n is not used, it just allow to create a have another constructor. */ + Shader(int glsl, int n); + + /* Construct a Shader reading colors in the VBO. Still used for containers and selection*/ + Shader(int glsl); + + /* Construct Shaders we use for entities + param glsl says which version of GL Shading Language we are using + param rgb define the color + param shade should be true for states, false either*/ + Shader(int glsl, Element_col, Element_col, Element_col, bool); + + //Destructor + ~Shader(); + + Shader& operator=(Shader const &shaderACopier); + + /*Loading function*/ + bool charger(); + /*Compilation function*/ + bool compilerShader(GLuint &shader, GLenum type, const std::string &code); + /*Getter*/ + GLuint getProgramID() const; + +private: + + GLuint m_vertexID {0}; + GLuint m_fragmentID {0}; + GLuint m_programID {0}; + + std::string m_vertex_code; + std::string m_fragment_code; +}; + +#endif diff --git a/src/render/TextVertexShader.fragmentshader b/src/render/TextVertexShader.fragmentshader index 2149a821390edf84c0a6d733091e34f9ce84ca7a..5fd61a8bcc2416a03de715b7b75f24b9bf292249 100644 --- a/src/render/TextVertexShader.fragmentshader +++ b/src/render/TextVertexShader.fragmentshader @@ -1,17 +1,17 @@ -#version 330 core - -// Interpolated values from the vertex shaders -in vec2 UV; - -// Ouput data -out vec4 color; - -// Values that stay constant for the whole mesh. -uniform sampler2D myTextureSampler; - -void main(){ - - color = texture2D( myTextureSampler, UV ); - - +#version 330 core + +// Interpolated values from the vertex shaders +in vec2 UV; + +// Ouput data +out vec4 color; + +// Values that stay constant for the whole mesh. +uniform sampler2D myTextureSampler; + +void main(){ + + color = texture2D( myTextureSampler, UV ); + + } \ No newline at end of file diff --git a/src/render/TextVertexShader.vertexshader b/src/render/TextVertexShader.vertexshader index bf59e66575cb3243eaa7d01186061db922668fc5..ccb615cb7f2eef7e44a16a0c0eabb05be2844148 100644 --- a/src/render/TextVertexShader.vertexshader +++ b/src/render/TextVertexShader.vertexshader @@ -1,21 +1,20 @@ -#version 330 core - -// Input vertex data, different for all executions of this shader. -layout(location = 0) in vec2 vertexPosition_screenspace; -layout(location = 1) in vec2 vertexUV; - -// Output data ; will be interpolated for each fragment. -out vec2 UV; - -void main(){ - - // Output position of the vertex, in clip space - // map [0..800][0..600] to [-1..1][-1..1] - vec2 vertexPosition_homoneneousspace = vertexPosition_screenspace - vec2(400,300); // [0..800][0..600] -> [-400..400][-300..300] - vertexPosition_homoneneousspace /= vec2(400,300); - gl_Position = vec4(vertexPosition_homoneneousspace,0,1); - - // UV of the vertex. No special space for this one. - UV = vertexUV; -} - +#version 330 core + +// Input vertex data, different for all executions of this shader. +layout(location = 0) in vec2 vertexPosition_screenspace; +layout(location = 1) in vec2 vertexUV; + +// Output data ; will be interpolated for each fragment. +out vec2 UV; + +void main(){ + + // Output position of the vertex, in clip space + // map [0..800][0..600] to [-1..1][-1..1] + vec2 vertexPosition_homoneneousspace = vertexPosition_screenspace - vec2(400,300); // [0..800][0..600] -> [-400..400][-300..300] + vertexPosition_homoneneousspace /= vec2(400,300); + gl_Position = vec4(vertexPosition_homoneneousspace,0,1); + + // UV of the vertex. No special space for this one. + UV = vertexUV; +} diff --git a/src/render/text2D.cpp b/src/render/text2D.cpp index bb79fdd8b2b6114d545474122d67ebfc754429cd..99b64d55e7acd1871788427a104fbe15019c62d3 100644 --- a/src/render/text2D.cpp +++ b/src/render/text2D.cpp @@ -1,128 +1,128 @@ -#include <vector> -#include <cstring> - -#include <GL/glew.h> -#define GLM_FORCE_RADIANS -#include <glm/glm.hpp> -#include <glm/gtc/matrix_transform.hpp> -#include <glm/gtc/type_ptr.hpp> -using namespace glm; - -#include "Shader.hpp" -#include "texture.hpp" - -#include "text2D.hpp" - -unsigned int Text2DTextureID; -unsigned int Text2DVertexBufferID; -unsigned int Text2DUVBufferID; -Shader* _shader; -unsigned int Text2DUniformID; - -void initText2D(const char * texturePath){ - - // Initialize texture - Text2DTextureID = loadDDS(texturePath); - - // Initialize VBO - glGenBuffers(1, &Text2DVertexBufferID); - glGenBuffers(1, &Text2DUVBufferID); - - // Initialize Shader - _shader = new Shader("TextVertexShader.vertexshader", "TextVertexShader.fragmentshader"); - _shader->charger(); - - // Initialize uniforms' IDs - Text2DUniformID = glGetUniformLocation( _shader->getProgramID(), "myTextureSampler" ); - -} - -void printText2D(const char * text, int x, int y, int size, glm::mat4 projection, glm::mat4 modelview){ - - unsigned int length = strlen(text); - - // Fill buffers - std::vector<glm::vec2> vertices; - std::vector<glm::vec2> UVs; - for ( unsigned int i=0 ; i<length ; i++ ){ - glm::vec2 vertex_up_left = glm::vec2( x+i*size , y+size ); - glm::vec2 vertex_up_right = glm::vec2( x+i*size+size, y+size ); - glm::vec2 vertex_down_right = glm::vec2( x+i*size+size, y-size ); - glm::vec2 vertex_down_left = glm::vec2( x+i*size , y-size ); - - vertices.push_back(vertex_up_left ); - vertices.push_back(vertex_down_left ); - vertices.push_back(vertex_up_right ); - - vertices.push_back(vertex_down_right); - vertices.push_back(vertex_up_right); - vertices.push_back(vertex_down_left); - - char character = text[i]; - float uv_x = (character%16)/16.0f; - float uv_y = (character/16)/16.0f; - - glm::vec2 uv_up_left = glm::vec2( uv_x , uv_y ); - glm::vec2 uv_up_right = glm::vec2( uv_x+1.0f/16.0f, uv_y ); - glm::vec2 uv_down_right = glm::vec2( uv_x+1.0f/16.0f, (uv_y + 1.0f/16.0f) ); - glm::vec2 uv_down_left = glm::vec2( uv_x , (uv_y + 1.0f/16.0f) ); - UVs.push_back(uv_up_left ); - UVs.push_back(uv_down_left ); - UVs.push_back(uv_up_right ); - - UVs.push_back(uv_down_right); - UVs.push_back(uv_up_right); - UVs.push_back(uv_down_left); - } - glBindBuffer(GL_ARRAY_BUFFER, Text2DVertexBufferID); - glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(glm::vec2), &vertices[0], GL_STATIC_DRAW); - glBindBuffer(GL_ARRAY_BUFFER, Text2DUVBufferID); - glBufferData(GL_ARRAY_BUFFER, UVs.size() * sizeof(glm::vec2), &UVs[0], GL_STATIC_DRAW); - - // Bind shader - glUseProgram(_shader->getProgramID()); - - // Bind texture - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, Text2DTextureID); - // Set our "myTextureSampler" sampler to user Texture Unit 0 - glUniform1i(Text2DUniformID, 0); - -glUniformMatrix4fv(glGetUniformLocation(_shader->getProgramID(), "modelview"), 1, GL_FALSE, glm::value_ptr(modelview)); -glUniformMatrix4fv(glGetUniformLocation(_shader->getProgramID(), "projection"), 1, GL_FALSE, glm::value_ptr(projection)); - - // 1rst attribute buffer : vertices - glEnableVertexAttribArray(0); - glBindBuffer(GL_ARRAY_BUFFER, Text2DVertexBufferID); - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, (void*)0 ); - - // 2nd attribute buffer : UVs - glEnableVertexAttribArray(1); - glBindBuffer(GL_ARRAY_BUFFER, Text2DUVBufferID); - glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, (void*)0 ); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - // Draw call - glDrawArrays(GL_TRIANGLES, 0, vertices.size() ); - - glDisable(GL_BLEND); - - glDisableVertexAttribArray(0); - glDisableVertexAttribArray(1); - -} - -void cleanupText2D(){ - - // Delete buffers - glDeleteBuffers(1, &Text2DVertexBufferID); - glDeleteBuffers(1, &Text2DUVBufferID); - - // Delete texture - glDeleteTextures(1, &Text2DTextureID); - - // Delete shader - glDeleteProgram(_shader->getProgramID()); -} +#include <vector> +#include <cstring> + +#include <GL/glew.h> +#define GLM_FORCE_RADIANS +#include <glm/glm.hpp> +#include <glm/gtc/matrix_transform.hpp> +#include <glm/gtc/type_ptr.hpp> +using namespace glm; + +#include "Shader.hpp" +#include "texture.hpp" + +#include "text2D.hpp" + +unsigned int Text2DTextureID; +unsigned int Text2DVertexBufferID; +unsigned int Text2DUVBufferID; +Shader* _shader; +unsigned int Text2DUniformID; + +void initText2D(const char * texturePath){ + + // Initialize texture + Text2DTextureID = loadDDS(texturePath); + + // Initialize VBO + glGenBuffers(1, &Text2DVertexBufferID); + glGenBuffers(1, &Text2DUVBufferID); + + // Initialize Shader + _shader = new Shader("TextVertexShader.vertexshader", "TextVertexShader.fragmentshader"); + _shader->charger(); + + // Initialize uniforms' IDs + Text2DUniformID = glGetUniformLocation( _shader->getProgramID(), "myTextureSampler" ); + +} + +void printText2D(const char * text, int x, int y, int size, glm::mat4 projection, glm::mat4 modelview){ + + unsigned int length = strlen(text); + + // Fill buffers + std::vector<glm::vec2> vertices; + std::vector<glm::vec2> UVs; + for ( unsigned int i=0 ; i<length ; i++ ){ + glm::vec2 vertex_up_left = glm::vec2( x+i*size , y+size ); + glm::vec2 vertex_up_right = glm::vec2( x+i*size+size, y+size ); + glm::vec2 vertex_down_right = glm::vec2( x+i*size+size, y-size ); + glm::vec2 vertex_down_left = glm::vec2( x+i*size , y-size ); + + vertices.push_back(vertex_up_left ); + vertices.push_back(vertex_down_left ); + vertices.push_back(vertex_up_right ); + + vertices.push_back(vertex_down_right); + vertices.push_back(vertex_up_right); + vertices.push_back(vertex_down_left); + + char character = text[i]; + float uv_x = (character%16)/16.0f; + float uv_y = (character/16)/16.0f; + + glm::vec2 uv_up_left = glm::vec2( uv_x , uv_y ); + glm::vec2 uv_up_right = glm::vec2( uv_x+1.0f/16.0f, uv_y ); + glm::vec2 uv_down_right = glm::vec2( uv_x+1.0f/16.0f, (uv_y + 1.0f/16.0f) ); + glm::vec2 uv_down_left = glm::vec2( uv_x , (uv_y + 1.0f/16.0f) ); + UVs.push_back(uv_up_left ); + UVs.push_back(uv_down_left ); + UVs.push_back(uv_up_right ); + + UVs.push_back(uv_down_right); + UVs.push_back(uv_up_right); + UVs.push_back(uv_down_left); + } + glBindBuffer(GL_ARRAY_BUFFER, Text2DVertexBufferID); + glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(glm::vec2), &vertices[0], GL_STATIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, Text2DUVBufferID); + glBufferData(GL_ARRAY_BUFFER, UVs.size() * sizeof(glm::vec2), &UVs[0], GL_STATIC_DRAW); + + // Bind shader + glUseProgram(_shader->getProgramID()); + + // Bind texture + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, Text2DTextureID); + // Set our "myTextureSampler" sampler to user Texture Unit 0 + glUniform1i(Text2DUniformID, 0); + + glUniformMatrix4fv(glGetUniformLocation(_shader->getProgramID(), "modelview"), 1, GL_FALSE, glm::value_ptr(modelview)); + glUniformMatrix4fv(glGetUniformLocation(_shader->getProgramID(), "projection"), 1, GL_FALSE, glm::value_ptr(projection)); + + // 1rst attribute buffer : vertices + glEnableVertexAttribArray(0); + glBindBuffer(GL_ARRAY_BUFFER, Text2DVertexBufferID); + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, (void*)0 ); + + // 2nd attribute buffer : UVs + glEnableVertexAttribArray(1); + glBindBuffer(GL_ARRAY_BUFFER, Text2DUVBufferID); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, (void*)0 ); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + // Draw call + glDrawArrays(GL_TRIANGLES, 0, vertices.size() ); + + glDisable(GL_BLEND); + + glDisableVertexAttribArray(0); + glDisableVertexAttribArray(1); + +} + +void cleanupText2D(){ + + // Delete buffers + glDeleteBuffers(1, &Text2DVertexBufferID); + glDeleteBuffers(1, &Text2DUVBufferID); + + // Delete texture + glDeleteTextures(1, &Text2DTextureID); + + // Delete shader + glDeleteProgram(_shader->getProgramID()); +} diff --git a/src/render/text2D.hpp b/src/render/text2D.hpp index 5ce3569b970ffe3f12d59d1b11dc052cedf01c47..843ada7dfd61bbda24b9b1b80453f3ef9eb44ca2 100644 --- a/src/render/text2D.hpp +++ b/src/render/text2D.hpp @@ -1,8 +1,8 @@ -#ifndef TEXT2D_HPP -#define TEXT2D_HPP - -void initText2D(const char * texturePath); -void printText2D(const char * text, int x, int y, int size, glm::mat4, glm::mat4); -void cleanupText2D(); - -#endif +#ifndef TEXT2D_HPP +#define TEXT2D_HPP + +void initText2D(const char * texturePath); +void printText2D(const char * text, int x, int y, int size, glm::mat4, glm::mat4); +void cleanupText2D(); + +#endif diff --git a/src/render/texture.cpp b/src/render/texture.cpp index 403936c6830e0f3cddca74ead6f42e8af7f0df6c..086e9785d4167d4552ac72b7acc9e27eff77e8d5 100644 --- a/src/render/texture.cpp +++ b/src/render/texture.cpp @@ -1,211 +1,211 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <GL/glew.h> - -//#include <glfw3.h> - - -/*GLuint loadBMP_custom(const char * imagepath){ - - printf("Reading image %s\n", imagepath); - - // Data read from the header of the BMP file - unsigned char header[54]; - unsigned int dataPos; - unsigned int imageSize; - unsigned int width, height; - // Actual RGB data - unsigned char * data; - - // Open the file - FILE * file = fopen(imagepath,"rb"); - if (!file) {printf("%s could not be opened. Are you in the right directory ? Don't forget to read the FAQ !\n", imagepath); getchar(); return 0;} - - // Read the header, i.e. the 54 first bytes - - // If less than 54 bytes are read, problem - if ( fread(header, 1, 54, file)!=54 ){ - printf("Not a correct BMP file\n"); - return 0; - } - // A BMP files always begins with "BM" - if ( header[0]!='B' || header[1]!='M' ){ - printf("Not a correct BMP file\n"); - return 0; - } - // Make sure this is a 24bpp file - if ( *(int*)&(header[0x1E])!=0 ) {printf("Not a correct BMP file\n"); return 0;} - if ( *(int*)&(header[0x1C])!=24 ) {printf("Not a correct BMP file\n"); return 0;} - - // Read the information about the image - dataPos = *(int*)&(header[0x0A]); - imageSize = *(int*)&(header[0x22]); - width = *(int*)&(header[0x12]); - height = *(int*)&(header[0x16]); - - // Some BMP files are misformatted, guess missing information - if (imageSize==0) imageSize=width*height*3; // 3 : one byte for each Red, Green and Blue component - if (dataPos==0) dataPos=54; // The BMP header is done that way - - // Create a buffer - data = new unsigned char [imageSize]; - - // Read the actual data from the file into the buffer - fread(data,1,imageSize,file); - - // Everything is in memory now, the file wan be closed - fclose (file); - - // Create one OpenGL texture - GLuint textureID; - glGenTextures(1, &textureID); - - // "Bind" the newly created texture : all future texture functions will modify this texture - glBindTexture(GL_TEXTURE_2D, textureID); - - // Give the image to OpenGL - glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, width, height, 0, GL_BGR, GL_UNSIGNED_BYTE, data); - - // OpenGL has now copied the data. Free our own version - delete [] data; - - // Poor filtering, or ... - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - - // ... nice trilinear filtering. - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glGenerateMipmap(GL_TEXTURE_2D); - - // Return the ID of the texture we just created - return textureID; -} - -// Since GLFW 3, glfwLoadTexture2D() has been removed. You have to use another texture loading library, -// or do it yourself (just like loadBMP_custom and loadDDS) -//GLuint loadTGA_glfw(const char * imagepath){ -// -// // Create one OpenGL texture -// GLuint textureID; -// glGenTextures(1, &textureID); -// -// // "Bind" the newly created texture : all future texture functions will modify this texture -// glBindTexture(GL_TEXTURE_2D, textureID); -// -// // Read the file, call glTexImage2D with the right parameters -// glfwLoadTexture2D(imagepath, 0); -// -// // Nice trilinear filtering. -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); -// glGenerateMipmap(GL_TEXTURE_2D); -// -// // Return the ID of the texture we just created -// return textureID; -//} - - - */ -#define FOURCC_DXT1 0x31545844 // Equivalent to "DXT1" in ASCII -#define FOURCC_DXT3 0x33545844 // Equivalent to "DXT3" in ASCII -#define FOURCC_DXT5 0x35545844 // Equivalent to "DXT5" in ASCII - -GLuint loadDDS(const char * imagepath){ - - unsigned char header[124]; - - FILE *fp; - - /* try to open the file */ - fp = fopen(imagepath, "rb"); - if (fp == NULL){ - printf("%s could not be opened. Are you in the right directory ? Don't forget to read the FAQ !\n", imagepath); getchar(); - return 0; - } - - /* verify the type of file */ - char filecode[4]; - fread(filecode, 1, 4, fp); - if (strncmp(filecode, "DDS ", 4) != 0) { - fclose(fp); - return 0; - } - - /* get the surface desc */ - fread(&header, 124, 1, fp); - - unsigned int height = *(unsigned int*)&(header[8 ]); - unsigned int width = *(unsigned int*)&(header[12]); - unsigned int linearSize = *(unsigned int*)&(header[16]); - unsigned int mipMapCount = *(unsigned int*)&(header[24]); - unsigned int fourCC = *(unsigned int*)&(header[80]); - - - unsigned char * buffer; - unsigned int bufsize; - /* how big is it going to be including all mipmaps? */ - bufsize = mipMapCount > 1 ? linearSize * 2 : linearSize; - buffer = (unsigned char*)malloc(bufsize * sizeof(unsigned char)); - fread(buffer, 1, bufsize, fp); - /* close the file pointer */ - fclose(fp); - - unsigned int components = (fourCC == FOURCC_DXT1) ? 3 : 4; - unsigned int format; - switch(fourCC) - { - case FOURCC_DXT1: - format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; - break; - case FOURCC_DXT3: - format = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; - break; - case FOURCC_DXT5: - format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; - break; - default: - free(buffer); - return 0; - } - - // Create one OpenGL texture - GLuint textureID; - glGenTextures(1, &textureID); - - // "Bind" the newly created texture : all future texture functions will modify this texture - glBindTexture(GL_TEXTURE_2D, textureID); - glPixelStorei(GL_UNPACK_ALIGNMENT,1); - - unsigned int blockSize = (format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) ? 8 : 16; - unsigned int offset = 0; - - /* load the mipmaps */ - for (unsigned int level = 0; level < mipMapCount && (width || height); ++level) - { - unsigned int size = ((width+3)/4)*((height+3)/4)*blockSize; - glCompressedTexImage2D(GL_TEXTURE_2D, level, format, width, height, - 0, size, buffer + offset); - - offset += size; - width /= 2; - height /= 2; - - // Deal with Non-Power-Of-Two textures. This code is not included in the webpage to reduce clutter. - if(width < 1) width = 1; - if(height < 1) height = 1; - - } - - free(buffer); - - return textureID; - - -} +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <GL/glew.h> + +//#include <glfw3.h> + + +/*GLuint loadBMP_custom(const char * imagepath){ + + printf("Reading image %s\n", imagepath); + + // Data read from the header of the BMP file + unsigned char header[54]; + unsigned int dataPos; + unsigned int imageSize; + unsigned int width, height; + // Actual RGB data + unsigned char * data; + + // Open the file + FILE * file = fopen(imagepath,"rb"); + if (!file) {printf("%s could not be opened. Are you in the right directory ? Don't forget to read the FAQ !\n", imagepath); getchar(); return 0;} + + // Read the header, i.e. the 54 first bytes + + // If less than 54 bytes are read, problem + if ( fread(header, 1, 54, file)!=54 ){ + printf("Not a correct BMP file\n"); + return 0; + } + // A BMP files always begins with "BM" + if ( header[0]!='B' || header[1]!='M' ){ + printf("Not a correct BMP file\n"); + return 0; + } + // Make sure this is a 24bpp file + if ( *(int*)&(header[0x1E])!=0 ) {printf("Not a correct BMP file\n"); return 0;} + if ( *(int*)&(header[0x1C])!=24 ) {printf("Not a correct BMP file\n"); return 0;} + + // Read the information about the image + dataPos = *(int*)&(header[0x0A]); + imageSize = *(int*)&(header[0x22]); + width = *(int*)&(header[0x12]); + height = *(int*)&(header[0x16]); + + // Some BMP files are misformatted, guess missing information + if (imageSize==0) imageSize=width*height*3; // 3 : one byte for each Red, Green and Blue component + if (dataPos==0) dataPos=54; // The BMP header is done that way + + // Create a buffer + data = new unsigned char [imageSize]; + + // Read the actual data from the file into the buffer + fread(data,1,imageSize,file); + + // Everything is in memory now, the file wan be closed + fclose (file); + + // Create one OpenGL texture + GLuint textureID; + glGenTextures(1, &textureID); + + // "Bind" the newly created texture : all future texture functions will modify this texture + glBindTexture(GL_TEXTURE_2D, textureID); + + // Give the image to OpenGL + glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, width, height, 0, GL_BGR, GL_UNSIGNED_BYTE, data); + + // OpenGL has now copied the data. Free our own version + delete [] data; + + // Poor filtering, or ... + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + + // ... nice trilinear filtering. + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glGenerateMipmap(GL_TEXTURE_2D); + + // Return the ID of the texture we just created + return textureID; + } + + // Since GLFW 3, glfwLoadTexture2D() has been removed. You have to use another texture loading library, + // or do it yourself (just like loadBMP_custom and loadDDS) + //GLuint loadTGA_glfw(const char * imagepath){ + // + // // Create one OpenGL texture + // GLuint textureID; + // glGenTextures(1, &textureID); + // + // // "Bind" the newly created texture : all future texture functions will modify this texture + // glBindTexture(GL_TEXTURE_2D, textureID); + // + // // Read the file, call glTexImage2D with the right parameters + // glfwLoadTexture2D(imagepath, 0); + // + // // Nice trilinear filtering. + // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + // glGenerateMipmap(GL_TEXTURE_2D); + // + // // Return the ID of the texture we just created + // return textureID; + //} + + + */ +#define FOURCC_DXT1 0x31545844 // Equivalent to "DXT1" in ASCII +#define FOURCC_DXT3 0x33545844 // Equivalent to "DXT3" in ASCII +#define FOURCC_DXT5 0x35545844 // Equivalent to "DXT5" in ASCII + +GLuint loadDDS(const char * imagepath){ + + unsigned char header[124]; + + FILE *fp; + + /* try to open the file */ + fp = fopen(imagepath, "rb"); + if (fp == NULL){ + printf("%s could not be opened. Are you in the right directory ? Don't forget to read the FAQ !\n", imagepath); getchar(); + return 0; + } + + /* verify the type of file */ + char filecode[4]; + fread(filecode, 1, 4, fp); + if (strncmp(filecode, "DDS ", 4) != 0) { + fclose(fp); + return 0; + } + + /* get the surface desc */ + fread(&header, 124, 1, fp); + + unsigned int height = *(unsigned int*)&(header[8 ]); + unsigned int width = *(unsigned int*)&(header[12]); + unsigned int linearSize = *(unsigned int*)&(header[16]); + unsigned int mipMapCount = *(unsigned int*)&(header[24]); + unsigned int fourCC = *(unsigned int*)&(header[80]); + + + unsigned char * buffer; + unsigned int bufsize; + /* how big is it going to be including all mipmaps? */ + bufsize = mipMapCount > 1 ? linearSize * 2 : linearSize; + buffer = (unsigned char*)malloc(bufsize * sizeof(unsigned char)); + fread(buffer, 1, bufsize, fp); + /* close the file pointer */ + fclose(fp); + + unsigned int components = (fourCC == FOURCC_DXT1) ? 3 : 4; + unsigned int format; + switch(fourCC) + { + case FOURCC_DXT1: + format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; + break; + case FOURCC_DXT3: + format = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; + break; + case FOURCC_DXT5: + format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; + break; + default: + free(buffer); + return 0; + } + + // Create one OpenGL texture + GLuint textureID; + glGenTextures(1, &textureID); + + // "Bind" the newly created texture : all future texture functions will modify this texture + glBindTexture(GL_TEXTURE_2D, textureID); + glPixelStorei(GL_UNPACK_ALIGNMENT,1); + + unsigned int blockSize = (format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) ? 8 : 16; + unsigned int offset = 0; + + /* load the mipmaps */ + for (unsigned int level = 0; level < mipMapCount && (width || height); ++level) + { + unsigned int size = ((width+3)/4)*((height+3)/4)*blockSize; + glCompressedTexImage2D(GL_TEXTURE_2D, level, format, width, height, + 0, size, buffer + offset); + + offset += size; + width /= 2; + height /= 2; + + // Deal with Non-Power-Of-Two textures. This code is not included in the webpage to reduce clutter. + if(width < 1) width = 1; + if(height < 1) height = 1; + + } + + free(buffer); + + return textureID; + + +} diff --git a/src/render/texture.hpp b/src/render/texture.hpp index db620fc0245fd345b34f187a4769f0c263635c19..39f5859039cc2944a5c5bbf8e1bf4f46de9432aa 100644 --- a/src/render/texture.hpp +++ b/src/render/texture.hpp @@ -1,16 +1,16 @@ -#ifndef TEXTURE_HPP -#define TEXTURE_HPP - -// Load a .BMP file using our custom loader -//GLuint loadBMP_custom(const char * imagepath); - -//// Since GLFW 3, glfwLoadTexture2D() has been removed. You have to use another texture loading library, -//// or do it yourself (just like loadBMP_custom and loadDDS) -//// Load a .TGA file using GLFW's own loader -//GLuint loadTGA_glfw(const char * imagepath); - -// Load a .DDS file using GLFW's own loader -GLuint loadDDS(const char * imagepath); - - -#endif +#ifndef TEXTURE_HPP +#define TEXTURE_HPP + +// Load a .BMP file using our custom loader +//GLuint loadBMP_custom(const char * imagepath); + +//// Since GLFW 3, glfwLoadTexture2D() has been removed. You have to use another texture loading library, +//// or do it yourself (just like loadBMP_custom and loadDDS) +//// Load a .TGA file using GLFW's own loader +//GLuint loadTGA_glfw(const char * imagepath); + +// Load a .DDS file using GLFW's own loader +GLuint loadDDS(const char * imagepath); + + +#endif diff --git a/src/trace/portable_archive_exception.hpp b/src/trace/portable_archive_exception.hpp index ef754ccfbb3b2944f7dea176f86f00e239d492a3..b5e7f818c068a9c7f5c44e084362bca525493668 100644 --- a/src/trace/portable_archive_exception.hpp +++ b/src/trace/portable_archive_exception.hpp @@ -1,79 +1,79 @@ -#pragma once - -#include <boost/lexical_cast.hpp> -#include <boost/archive/basic_archive.hpp> -#include <boost/archive/archive_exception.hpp> - -namespace eos { - - // this value is written to the top of the stream - const signed char magic_byte = 'e' | 'o' | 's'; - - // flag for fp serialization - const unsigned no_infnan = 64; - - // integral type for the archive version - #if BOOST_VERSION < 104400 - typedef boost::archive::version_type archive_version_type; - #else - typedef boost::archive::library_version_type archive_version_type; - #endif - - // version of the linked boost archive library - const archive_version_type archive_version( - #if BOOST_VERSION < 103700 - boost::archive::ARCHIVE_VERSION() - #else - boost::archive::BOOST_ARCHIVE_VERSION() - #endif - ); - - /** - * \brief Exception being thrown when serialization cannot proceed. - * - * There are several situations in which the portable archives may fail and - * hence throw an exception: - * -# deserialization of an integer value that exceeds the range of the type - * -# (de)serialization of inf/nan through an archive with no_infnan flag set - * -# deserialization of a denormalized value without the floating point type - * supporting denormalized numbers - * - * Note that this exception will also be thrown if you mixed up your stream - * position and accidentially interpret some value for size data (in this case - * the reported size will be totally amiss most of the time). - */ - class portable_archive_exception : public boost::archive::archive_exception - { - std::string msg; - - public: - //! type size is not large enough for deserialized number - portable_archive_exception(signed char invalid_size) - : boost::archive::archive_exception(other_exception) - , msg("requested integer size exceeds type size: ") - { - msg += boost::lexical_cast<std::string, int>(invalid_size); - } - - //! negative number in unsigned type - portable_archive_exception() - : boost::archive::archive_exception(other_exception) - , msg("cannot read a negative number into an unsigned type") - { - } - - //! serialization of inf, nan and denormals - template <typename T> - portable_archive_exception(const T& abnormal) - : boost::archive::archive_exception(other_exception) - , msg("serialization of illegal floating point value: ") - { - msg += boost::lexical_cast<std::string>(abnormal); - } - - //! override the base class function with our message - const char* what() const throw() { return msg.c_str(); } - ~portable_archive_exception() throw() {} - }; - -} // namespace eos +#pragma once + +#include <boost/lexical_cast.hpp> +#include <boost/archive/basic_archive.hpp> +#include <boost/archive/archive_exception.hpp> + +namespace eos { + + // this value is written to the top of the stream + const signed char magic_byte = 'e' | 'o' | 's'; + + // flag for fp serialization + const unsigned no_infnan = 64; + + // integral type for the archive version +#if BOOST_VERSION < 104400 + typedef boost::archive::version_type archive_version_type; +#else + typedef boost::archive::library_version_type archive_version_type; +#endif + + // version of the linked boost archive library + const archive_version_type archive_version( +#if BOOST_VERSION < 103700 + boost::archive::ARCHIVE_VERSION() +#else + boost::archive::BOOST_ARCHIVE_VERSION() +#endif + ); + + /** + * \brief Exception being thrown when serialization cannot proceed. + * + * There are several situations in which the portable archives may fail and + * hence throw an exception: + * -# deserialization of an integer value that exceeds the range of the type + * -# (de)serialization of inf/nan through an archive with no_infnan flag set + * -# deserialization of a denormalized value without the floating point type + * supporting denormalized numbers + * + * Note that this exception will also be thrown if you mixed up your stream + * position and accidentially interpret some value for size data (in this case + * the reported size will be totally amiss most of the time). + */ + class portable_archive_exception : public boost::archive::archive_exception + { + std::string msg; + + public: + //! type size is not large enough for deserialized number + portable_archive_exception(signed char invalid_size) + : boost::archive::archive_exception(other_exception) + , msg("requested integer size exceeds type size: ") + { + msg += boost::lexical_cast<std::string, int>(invalid_size); + } + + //! negative number in unsigned type + portable_archive_exception() + : boost::archive::archive_exception(other_exception) + , msg("cannot read a negative number into an unsigned type") + { + } + + //! serialization of inf, nan and denormals + template <typename T> + portable_archive_exception(const T& abnormal) + : boost::archive::archive_exception(other_exception) + , msg("serialization of illegal floating point value: ") + { + msg += boost::lexical_cast<std::string>(abnormal); + } + + //! override the base class function with our message + const char* what() const throw() { return msg.c_str(); } + ~portable_archive_exception() throw() {} + }; + +} // namespace eos diff --git a/src/trace/portable_iarchive.hpp b/src/trace/portable_iarchive.hpp index aad222be926725cd876be032a07f10930edec3ee..c6107bc0ff2305973c184ed5b85efe602efbcc47 100644 --- a/src/trace/portable_iarchive.hpp +++ b/src/trace/portable_iarchive.hpp @@ -1,459 +1,459 @@ -/*****************************************************************************/ -/** - * \file portable_iarchive.hpp - * \brief Provides an archive to read from portable binary files. - * \author christian.pfligersdorffer@eos.info - * \version 4.2 - * - * This archive (pair) brings the advantanges of binary streams to the cross - * platform boost::serialization user. While being almost as fast as the native - * binary archive it allows its files to be exchanged between cpu architectures - * using different byte order (endianness). Speaking of speed: in serializing - * numbers the (portable) binary approach is approximately ten times faster than - * the ascii implementation (that is inherently portable)! - * - * Based on the portable archive example by Robert Ramey this implementation - * uses Beman Dawes endian library and fp_utilities from Johan Rade, both being - * in boost since 1.36. Prior to that you need to add them both (header only) - * to your boost directory before you're able to use the archives provided. - * Our archives have been tested successfully for boost versions 1.33 to 1.46! - * - * \note Correct behaviour has so far been confirmed using PowerPC-32, x86-32 - * and x86-64 platforms featuring different byte order. So there is a good - * chance it will instantly work for your specific setup. If you encounter - * problems or have suggestions please contact the author. - * - * \note Version 4.2 maintains compatibility with the latest boost 1.46 and adds - * serialization of special floating point values inf and NaN as proposed - * by Francois Mauger. - * - * \note Version 4.1 makes the archives work together with boost 1.40 and 1.41. - * Thanks to Francois Mauger for his suggestions. - * - * \note Version 4 removes one level of the inheritance hierachy and directly - * builds upon binary primitive and basic binary archive, thereby fixing - * the last open issue regarding array serialization. Thanks to Robert - * Ramey for the hint. - * - * \note A few fixes introduced in version 3.1 let the archives pass all of the - * serialization tests. Thanks to Sergey Morozov for running the tests. - * Wouter Bijlsma pointed out where to find the fp_utilities and endian - * libraries headers inside the boost distribution. I would never have - * found them so thank him it works out of the box since boost 1.36. - * - * \note With Version 3.0 the archives have been made portable across different - * boost versions. For that purpose a header is added to the data that - * supplies the underlying serialization library version. Backwards - * compatibility is maintained by assuming library version boost 1.33 if - * the iarchive is created using the no_header flag. Whether a header is - * present or not can be guessed by peeking into the stream: the header's - * first byte is the magic number 127 coinciding with 'e' | 'o' | 's' :-) - * - * \note Version 2.1 removes several compiler warnings and enhances floating - * point diagnostics to inform the user if some preconditions are violated - * on his platform. We do not strive for the universally portable solution - * in binary floating point serialization as desired by some boost users. - * Instead we support only the most widely used IEEE 754 format and try to - * detect when requirements are not met and hence our approach must fail. - * Contributions we made by Johan Rade and �kos Mar�y. - * - * \note Version 2.0 fixes a serious bug that effectively transformed most - * of negative integral values into positive values! For example the two - * numbers -12 and 234 were stored in the same 8-bit pattern and later - * always restored to 234. This was fixed in this version in a way that - * does not change the interpretation of existing archives that did work - * because there were no negative numbers. The other way round archives - * created by version 2.0 and containing negative numbers will raise an - * integer type size exception when reading it with version 1.0. Thanks - * to Markus Frohnmaier for testing the archives and finding the bug. - * - * \copyright The boost software license applies. - */ -/*****************************************************************************/ - -#pragma once - -#include <istream> - -// basic headers -#include <boost/version.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/archive/basic_binary_iprimitive.hpp> -#include <boost/archive/basic_binary_iarchive.hpp> - -#if BOOST_VERSION >= 103500 -#include <boost/archive/shared_ptr_helper.hpp> -#endif - -// funny polymorphics -#if BOOST_VERSION < 103500 -#include <boost/archive/detail/polymorphic_iarchive_impl.hpp> -#define POLYMORPHIC(T) boost::archive::detail::polymorphic_iarchive_impl<T> - -#elif BOOST_VERSION < 103600 -#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp> -#define POLYMORPHIC(T) boost::archive::detail::polymorphic_iarchive_dispatch<T> - -#else -#include <boost/archive/detail/polymorphic_iarchive_route.hpp> -#define POLYMORPHIC(T) boost::archive::detail::polymorphic_iarchive_route<T> -#endif - -// endian and fpclassify -#if BOOST_VERSION < 103600 -#include <boost/integer/endian.hpp> -#include <boost/math/fpclassify.hpp> -#elif BOOST_VERSION < 104800 -#include <boost/spirit/home/support/detail/integer/endian.hpp> -#include <boost/spirit/home/support/detail/math/fpclassify.hpp> -#else -#include <boost/spirit/home/support/detail/endian.hpp> -#include <boost/spirit/home/support/detail/math/fpclassify.hpp> -#endif - -// namespace alias -#if BOOST_VERSION < 103800 -namespace fp = boost::math; -#else -namespace fp = boost::spirit::math; -#endif - -// generic type traits for numeric types -#include <boost/type_traits/is_integral.hpp> -#include <boost/type_traits/is_unsigned.hpp> -#include <boost/type_traits/is_arithmetic.hpp> -#include <boost/type_traits/is_floating_point.hpp> - -#include "portable_archive_exception.hpp" - -// hint from Johan Rade: on VMS there is still support for -// the VAX floating point format and this macro detects it -#if defined(__vms) && defined(__DECCXX) && !__IEEE_FLOAT -#error "VAX floating point format is not supported!" -#endif - -namespace eos { - - // forward declaration - class portable_iarchive; - - typedef boost::archive::basic_binary_iprimitive< - portable_iarchive - #if BOOST_VERSION < 103400 - , std::istream - #else - , std::istream::char_type - , std::istream::traits_type - #endif - > portable_iprimitive; - - /** - * \brief Portable binary input archive using little endian format. - * - * This archive addresses integer size, endianness and floating point types so - * that data can be transferred across different systems. There may still be - * constraints as to what systems are compatible and the user will have to take - * care that e.g. a very large int being saved on a 64 bit machine will result - * in a portable_archive_exception if loaded into an int on a 32 bit system. - * A possible workaround to this would be to use fixed types like - * boost::uint64_t in your serialization structures. - * - * \note The class is based on the portable binary example by Robert Ramey and - * uses Beman Dawes endian library plus fp_utilities by Johan Rade. - */ - class portable_iarchive : public portable_iprimitive - - // the example derives from common_oarchive but that lacks the - // load_override functions so we chose to stay one level higher - , public boost::archive::basic_binary_iarchive<portable_iarchive> - - #if BOOST_VERSION >= 103500 - // mix-in helper class for serializing shared_ptr - , public boost::archive::detail::shared_ptr_helper - #endif - { - // only needed for Robert's hack in basic_binary_iarchive::init - friend class boost::archive::basic_binary_iarchive<portable_iarchive>; - - // workaround for gcc: use a dummy struct - // as additional argument type for overloading - template <int> struct dummy { dummy(int) {}}; - - // loads directly from stream - signed char load_signed_char() - { - signed char c; - portable_iprimitive::load(c); - return c; - } - - // archive initialization - void init(unsigned flags) - { - using namespace boost::archive; - archive_version_type input_library_version(3); - - // it is vital to have version information! - // if we don't have any we assume boost 1.33 - if (flags & no_header) - set_library_version(input_library_version); - - // extract and check the magic eos byte - else if (load_signed_char() != magic_byte) - throw archive_exception(archive_exception::invalid_signature); - - else - { - // extract version information - operator>>(input_library_version); - - // throw if file version is newer than we are - if (input_library_version > archive_version) - throw archive_exception(archive_exception::unsupported_version); - - // else set the library version accordingly - else set_library_version(input_library_version); - } - } - - public: - //! Load string types. - template <class C, class T, class A> - void load(std::basic_string<C, T, A>& s) - { - // implementation only valid for narrow string - BOOST_STATIC_ASSERT(sizeof(C) == sizeof(char)); - portable_iprimitive::load(s); - } - - //! Special case loading bool type, preserving compatibility - //! to integer types - this is somewhat redundant but simply - //! treating bool as integer type generates lots of warnings - void load(bool& b) - { - switch (signed char c = load_signed_char()) - { - case 0: b = false; break; - case 1: b = load_signed_char(); break; - default: throw portable_archive_exception(c); - } - } - - /** - * \brief Load integer types. - * - * First we load the size information ie. the number of bytes that - * hold the actual data. Then we retrieve the data and transform it - * to the original value by using load_little_endian. - */ - template <typename T> - typename boost::enable_if<boost::is_integral<T> >::type - load(T & t, dummy<2> = 0) - { - // get the number of bytes in the stream - if (signed char size = load_signed_char()) - { - // check for negative value in unsigned type - if (size < 0 && boost::is_unsigned<T>::value) - throw portable_archive_exception(); - - // check that our type T is large enough - else if ((unsigned) abs(size) > sizeof(T)) - throw portable_archive_exception(size); - - // reconstruct the value - T temp = size < 0 ? -1 : 0; - load_binary(&temp, abs(size)); - - // load the value from little endian - is is then converted - // to the target type T and fits it because size <= sizeof(T) - #if BOOST_VERSION < 104800 - t = boost::detail::load_little_endian<T, sizeof(T)>(&temp); - #else - t = boost::spirit::detail::load_little_endian<T, sizeof(T)>(&temp); - #endif - } - - else t = 0; // zero optimization - } - - /** - * \brief Load floating point types. - * - * We simply rely on fp_traits to set the bit pattern from the (unsigned) - * integral type that was stored in the stream. Francois Mauger provided - * standardized behaviour for special values like inf and NaN, that need to - * be serialized in his application. - * - * \note by Johan Rade (author of the floating point utilities library): - * Be warned that the math::detail::fp_traits<T>::type::get_bits() function - * is *not* guaranteed to give you all bits of the floating point number. It - * will give you all bits if and only if there is an integer type that has - * the same size as the floating point you are copying from. It will not - * give you all bits for double if there is no uint64_t. It will not give - * you all bits for long double if sizeof(long double) > 8 or there is no - * uint64_t. - * - * The member fp_traits<T>::type::coverage will tell you whether all bits - * are copied. This is a typedef for either math::detail::all_bits or - * math::detail::not_all_bits. - * - * If the function does not copy all bits, then it will copy the most - * significant bits. So if you serialize and deserialize the way you - * describe, and fp_traits<T>::type::coverage is math::detail::not_all_bits, - * then your floating point numbers will be truncated. This will introduce - * small rounding off errors. - */ - template <typename T> - typename boost::enable_if<boost::is_floating_point<T> >::type - load(T & t, dummy<3> = 0) - { - typedef typename fp::detail::fp_traits<T>::type traits; - - // if you end here there are three possibilities: - // 1. you're serializing a long double which is not portable - // 2. you're serializing a double but have no 64 bit integer - // 3. your machine is using an unknown floating point format - // after reading the note above you still might decide to - // deactivate this static assert and try if it works out. - typename traits::bits bits; - BOOST_STATIC_ASSERT(sizeof(bits) == sizeof(T)); - BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_iec559); - - load(bits); - traits::set_bits(t, bits); - - // if the no_infnan flag is set we must throw here - if (get_flags() & no_infnan && !fp::isfinite(t)) - throw portable_archive_exception(t); - - // if you end here your floating point type does not support - // denormalized numbers. this might be the case even though - // your type conforms to IEC 559 (and thus to IEEE 754) - if (std::numeric_limits<T>::has_denorm == std::denorm_absent - && fp::fpclassify(t) == (int) FP_SUBNORMAL) // GCC4 - throw portable_archive_exception(t); - } - - /** - * \brief Constructor on a stream using ios::binary mode! - * - * We cannot call basic_binary_iprimitive::init which tries to detect - * if the binary archive stems from a different platform by examining - * type sizes. - * - * We could have called basic_binary_iarchive::init which would create - * the boost::serialization standard archive header containing also the - * library version. Due to efficiency we stick with our own. - */ - portable_iarchive(std::istream& is, unsigned flags = 0) - #if BOOST_VERSION < 103400 - : portable_iprimitive(is, flags & boost::archive::no_codecvt) - #else - : portable_iprimitive(*is.rdbuf(), flags & boost::archive::no_codecvt) - #endif - , boost::archive::basic_binary_iarchive<portable_iarchive>(flags) - { - init(flags); - } - - #if BOOST_VERSION >= 103400 - portable_iarchive(std::streambuf& sb, unsigned flags = 0) - : portable_iprimitive(sb, flags & boost::archive::no_codecvt) - , boost::archive::basic_binary_iarchive<portable_iarchive>(flags) - { - init(flags); - } - #endif - - #if BOOST_VERSION >= 104400 - // in boost 1.44 version_type was splitted into library_version_type and - // item_version_type, plus a whole bunch of additional strong typedefs - void load(boost::archive::library_version_type& version) - { - load((boost::uint_least16_t&)(version)); - } - - void load(boost::archive::class_id_type& class_id) - { - load((boost::uint_least16_t&)(class_id)); - } - - void load(boost::serialization::item_version_type& version) - { - load((boost::uint_least32_t&)(version)); - } - - void load(boost::serialization::collection_size_type& version) - { - load((boost::uint_least32_t&)(version)); - } - - void load(boost::archive::object_id_type& object_id) - { - load((boost::uint_least32_t&)(object_id)); - } - - void load(boost::archive::version_type& version) - { - load((boost::uint_least32_t&)(version)); - } - #endif - }; - - // polymorphic portable binary iarchive typdef - typedef POLYMORPHIC(portable_iarchive) polymorphic_portable_iarchive; - #undef POLYMORPHIC - -} // namespace eos - -// this is required by export which registers all of your -// classes with all the inbuilt archives plus our archive. -#if BOOST_VERSION < 103500 -#define BOOST_ARCHIVE_CUSTOM_IARCHIVE_TYPES eos::portable_iarchive -#else -BOOST_SERIALIZATION_REGISTER_ARCHIVE(eos::portable_iarchive) -BOOST_SERIALIZATION_REGISTER_ARCHIVE(eos::polymorphic_portable_iarchive) -#endif - -// if you include this header multiple times and your compiler is picky -// about multiple template instantiations (eg. gcc is) then you need to -// define NO_EXPLICIT_TEMPLATE_INSTANTIATION before every include but one -// or you move the instantiation section into an implementation file -#ifndef NO_EXPLICIT_TEMPLATE_INSTANTIATION - -#include <boost/archive/impl/basic_binary_iarchive.ipp> -#include <boost/archive/impl/basic_binary_iprimitive.ipp> - -#if BOOST_VERSION < 104000 -#include <boost/archive/impl/archive_pointer_iserializer.ipp> -#elif !defined BOOST_ARCHIVE_SERIALIZER_INCLUDED -#include <boost/archive/impl/archive_serializer_map.ipp> -#define BOOST_ARCHIVE_SERIALIZER_INCLUDED -#endif - -namespace boost { namespace archive { - - // explicitly instantiate for this type of binary stream - template class basic_binary_iarchive<eos::portable_iarchive>; - - template class basic_binary_iprimitive< - eos::portable_iarchive - #if BOOST_VERSION < 103400 - , std::istream - #else - , std::istream::char_type - , std::istream::traits_type - #endif - >; - -#if BOOST_VERSION < 104000 - template class detail::archive_pointer_iserializer<eos::portable_iarchive>; -#else - template class detail::archive_serializer_map<eos::portable_iarchive>; - //template class detail::archive_serializer_map<eos::polymorphic_portable_iarchive>; -#endif - -} } // namespace boost::archive - -#endif +/*****************************************************************************/ +/** + * \file portable_iarchive.hpp + * \brief Provides an archive to read from portable binary files. + * \author christian.pfligersdorffer@eos.info + * \version 4.2 + * + * This archive (pair) brings the advantanges of binary streams to the cross + * platform boost::serialization user. While being almost as fast as the native + * binary archive it allows its files to be exchanged between cpu architectures + * using different byte order (endianness). Speaking of speed: in serializing + * numbers the (portable) binary approach is approximately ten times faster than + * the ascii implementation (that is inherently portable)! + * + * Based on the portable archive example by Robert Ramey this implementation + * uses Beman Dawes endian library and fp_utilities from Johan Rade, both being + * in boost since 1.36. Prior to that you need to add them both (header only) + * to your boost directory before you're able to use the archives provided. + * Our archives have been tested successfully for boost versions 1.33 to 1.46! + * + * \note Correct behaviour has so far been confirmed using PowerPC-32, x86-32 + * and x86-64 platforms featuring different byte order. So there is a good + * chance it will instantly work for your specific setup. If you encounter + * problems or have suggestions please contact the author. + * + * \note Version 4.2 maintains compatibility with the latest boost 1.46 and adds + * serialization of special floating point values inf and NaN as proposed + * by Francois Mauger. + * + * \note Version 4.1 makes the archives work together with boost 1.40 and 1.41. + * Thanks to Francois Mauger for his suggestions. + * + * \note Version 4 removes one level of the inheritance hierachy and directly + * builds upon binary primitive and basic binary archive, thereby fixing + * the last open issue regarding array serialization. Thanks to Robert + * Ramey for the hint. + * + * \note A few fixes introduced in version 3.1 let the archives pass all of the + * serialization tests. Thanks to Sergey Morozov for running the tests. + * Wouter Bijlsma pointed out where to find the fp_utilities and endian + * libraries headers inside the boost distribution. I would never have + * found them so thank him it works out of the box since boost 1.36. + * + * \note With Version 3.0 the archives have been made portable across different + * boost versions. For that purpose a header is added to the data that + * supplies the underlying serialization library version. Backwards + * compatibility is maintained by assuming library version boost 1.33 if + * the iarchive is created using the no_header flag. Whether a header is + * present or not can be guessed by peeking into the stream: the header's + * first byte is the magic number 127 coinciding with 'e' | 'o' | 's' :-) + * + * \note Version 2.1 removes several compiler warnings and enhances floating + * point diagnostics to inform the user if some preconditions are violated + * on his platform. We do not strive for the universally portable solution + * in binary floating point serialization as desired by some boost users. + * Instead we support only the most widely used IEEE 754 format and try to + * detect when requirements are not met and hence our approach must fail. + * Contributions we made by Johan Rade and �kos Mar�y. + * + * \note Version 2.0 fixes a serious bug that effectively transformed most + * of negative integral values into positive values! For example the two + * numbers -12 and 234 were stored in the same 8-bit pattern and later + * always restored to 234. This was fixed in this version in a way that + * does not change the interpretation of existing archives that did work + * because there were no negative numbers. The other way round archives + * created by version 2.0 and containing negative numbers will raise an + * integer type size exception when reading it with version 1.0. Thanks + * to Markus Frohnmaier for testing the archives and finding the bug. + * + * \copyright The boost software license applies. + */ +/*****************************************************************************/ + +#pragma once + +#include <istream> + +// basic headers +#include <boost/version.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/archive/basic_binary_iprimitive.hpp> +#include <boost/archive/basic_binary_iarchive.hpp> + +#if BOOST_VERSION >= 103500 +#include <boost/archive/shared_ptr_helper.hpp> +#endif + +// funny polymorphics +#if BOOST_VERSION < 103500 +#include <boost/archive/detail/polymorphic_iarchive_impl.hpp> +#define POLYMORPHIC(T) boost::archive::detail::polymorphic_iarchive_impl<T> + +#elif BOOST_VERSION < 103600 +#include <boost/archive/detail/polymorphic_iarchive_dispatch.hpp> +#define POLYMORPHIC(T) boost::archive::detail::polymorphic_iarchive_dispatch<T> + +#else +#include <boost/archive/detail/polymorphic_iarchive_route.hpp> +#define POLYMORPHIC(T) boost::archive::detail::polymorphic_iarchive_route<T> +#endif + +// endian and fpclassify +#if BOOST_VERSION < 103600 +#include <boost/integer/endian.hpp> +#include <boost/math/fpclassify.hpp> +#elif BOOST_VERSION < 104800 +#include <boost/spirit/home/support/detail/integer/endian.hpp> +#include <boost/spirit/home/support/detail/math/fpclassify.hpp> +#else +#include <boost/spirit/home/support/detail/endian.hpp> +#include <boost/spirit/home/support/detail/math/fpclassify.hpp> +#endif + +// namespace alias +#if BOOST_VERSION < 103800 + namespace fp = boost::math; +#else +namespace fp = boost::spirit::math; +#endif + +// generic type traits for numeric types +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/is_unsigned.hpp> +#include <boost/type_traits/is_arithmetic.hpp> +#include <boost/type_traits/is_floating_point.hpp> + +#include "portable_archive_exception.hpp" + +// hint from Johan Rade: on VMS there is still support for +// the VAX floating point format and this macro detects it +#if defined(__vms) && defined(__DECCXX) && !__IEEE_FLOAT +#error "VAX floating point format is not supported!" +#endif + +namespace eos { + + // forward declaration + class portable_iarchive; + + typedef boost::archive::basic_binary_iprimitive< + portable_iarchive +#if BOOST_VERSION < 103400 + , std::istream +#else + , std::istream::char_type + , std::istream::traits_type +#endif + > portable_iprimitive; + + /** + * \brief Portable binary input archive using little endian format. + * + * This archive addresses integer size, endianness and floating point types so + * that data can be transferred across different systems. There may still be + * constraints as to what systems are compatible and the user will have to take + * care that e.g. a very large int being saved on a 64 bit machine will result + * in a portable_archive_exception if loaded into an int on a 32 bit system. + * A possible workaround to this would be to use fixed types like + * boost::uint64_t in your serialization structures. + * + * \note The class is based on the portable binary example by Robert Ramey and + * uses Beman Dawes endian library plus fp_utilities by Johan Rade. + */ + class portable_iarchive : public portable_iprimitive + + // the example derives from common_oarchive but that lacks the + // load_override functions so we chose to stay one level higher + , public boost::archive::basic_binary_iarchive<portable_iarchive> + +#if BOOST_VERSION >= 103500 + // mix-in helper class for serializing shared_ptr + , public boost::archive::detail::shared_ptr_helper +#endif + { + // only needed for Robert's hack in basic_binary_iarchive::init + friend class boost::archive::basic_binary_iarchive<portable_iarchive>; + + // workaround for gcc: use a dummy struct + // as additional argument type for overloading + template <int> struct dummy { dummy(int) {}}; + + // loads directly from stream + signed char load_signed_char() + { + signed char c; + portable_iprimitive::load(c); + return c; + } + + // archive initialization + void init(unsigned flags) + { + using namespace boost::archive; + archive_version_type input_library_version(3); + + // it is vital to have version information! + // if we don't have any we assume boost 1.33 + if (flags & no_header) + set_library_version(input_library_version); + + // extract and check the magic eos byte + else if (load_signed_char() != magic_byte) + throw archive_exception(archive_exception::invalid_signature); + + else + { + // extract version information + operator>>(input_library_version); + + // throw if file version is newer than we are + if (input_library_version > archive_version) + throw archive_exception(archive_exception::unsupported_version); + + // else set the library version accordingly + else set_library_version(input_library_version); + } + } + + public: + //! Load string types. + template <class C, class T, class A> + void load(std::basic_string<C, T, A>& s) + { + // implementation only valid for narrow string + BOOST_STATIC_ASSERT(sizeof(C) == sizeof(char)); + portable_iprimitive::load(s); + } + + //! Special case loading bool type, preserving compatibility + //! to integer types - this is somewhat redundant but simply + //! treating bool as integer type generates lots of warnings + void load(bool& b) + { + switch (signed char c = load_signed_char()) + { + case 0: b = false; break; + case 1: b = load_signed_char(); break; + default: throw portable_archive_exception(c); + } + } + + /** + * \brief Load integer types. + * + * First we load the size information ie. the number of bytes that + * hold the actual data. Then we retrieve the data and transform it + * to the original value by using load_little_endian. + */ + template <typename T> + typename boost::enable_if<boost::is_integral<T> >::type + load(T & t, dummy<2> = 0) + { + // get the number of bytes in the stream + if (signed char size = load_signed_char()) + { + // check for negative value in unsigned type + if (size < 0 && boost::is_unsigned<T>::value) + throw portable_archive_exception(); + + // check that our type T is large enough + else if ((unsigned) abs(size) > sizeof(T)) + throw portable_archive_exception(size); + + // reconstruct the value + T temp = size < 0 ? -1 : 0; + load_binary(&temp, abs(size)); + + // load the value from little endian - is is then converted + // to the target type T and fits it because size <= sizeof(T) +#if BOOST_VERSION < 104800 + t = boost::detail::load_little_endian<T, sizeof(T)>(&temp); +#else + t = boost::spirit::detail::load_little_endian<T, sizeof(T)>(&temp); +#endif + } + + else t = 0; // zero optimization + } + + /** + * \brief Load floating point types. + * + * We simply rely on fp_traits to set the bit pattern from the (unsigned) + * integral type that was stored in the stream. Francois Mauger provided + * standardized behaviour for special values like inf and NaN, that need to + * be serialized in his application. + * + * \note by Johan Rade (author of the floating point utilities library): + * Be warned that the math::detail::fp_traits<T>::type::get_bits() function + * is *not* guaranteed to give you all bits of the floating point number. It + * will give you all bits if and only if there is an integer type that has + * the same size as the floating point you are copying from. It will not + * give you all bits for double if there is no uint64_t. It will not give + * you all bits for long double if sizeof(long double) > 8 or there is no + * uint64_t. + * + * The member fp_traits<T>::type::coverage will tell you whether all bits + * are copied. This is a typedef for either math::detail::all_bits or + * math::detail::not_all_bits. + * + * If the function does not copy all bits, then it will copy the most + * significant bits. So if you serialize and deserialize the way you + * describe, and fp_traits<T>::type::coverage is math::detail::not_all_bits, + * then your floating point numbers will be truncated. This will introduce + * small rounding off errors. + */ + template <typename T> + typename boost::enable_if<boost::is_floating_point<T> >::type + load(T & t, dummy<3> = 0) + { + typedef typename fp::detail::fp_traits<T>::type traits; + + // if you end here there are three possibilities: + // 1. you're serializing a long double which is not portable + // 2. you're serializing a double but have no 64 bit integer + // 3. your machine is using an unknown floating point format + // after reading the note above you still might decide to + // deactivate this static assert and try if it works out. + typename traits::bits bits; + BOOST_STATIC_ASSERT(sizeof(bits) == sizeof(T)); + BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_iec559); + + load(bits); + traits::set_bits(t, bits); + + // if the no_infnan flag is set we must throw here + if (get_flags() & no_infnan && !fp::isfinite(t)) + throw portable_archive_exception(t); + + // if you end here your floating point type does not support + // denormalized numbers. this might be the case even though + // your type conforms to IEC 559 (and thus to IEEE 754) + if (std::numeric_limits<T>::has_denorm == std::denorm_absent + && fp::fpclassify(t) == (int) FP_SUBNORMAL) // GCC4 + throw portable_archive_exception(t); + } + + /** + * \brief Constructor on a stream using ios::binary mode! + * + * We cannot call basic_binary_iprimitive::init which tries to detect + * if the binary archive stems from a different platform by examining + * type sizes. + * + * We could have called basic_binary_iarchive::init which would create + * the boost::serialization standard archive header containing also the + * library version. Due to efficiency we stick with our own. + */ + portable_iarchive(std::istream& is, unsigned flags = 0) +#if BOOST_VERSION < 103400 + : portable_iprimitive(is, flags & boost::archive::no_codecvt) +#else + : portable_iprimitive(*is.rdbuf(), flags & boost::archive::no_codecvt) +#endif + , boost::archive::basic_binary_iarchive<portable_iarchive>(flags) + { + init(flags); + } + +#if BOOST_VERSION >= 103400 + portable_iarchive(std::streambuf& sb, unsigned flags = 0) + : portable_iprimitive(sb, flags & boost::archive::no_codecvt) + , boost::archive::basic_binary_iarchive<portable_iarchive>(flags) + { + init(flags); + } +#endif + +#if BOOST_VERSION >= 104400 + // in boost 1.44 version_type was splitted into library_version_type and + // item_version_type, plus a whole bunch of additional strong typedefs + void load(boost::archive::library_version_type& version) + { + load((boost::uint_least16_t&)(version)); + } + + void load(boost::archive::class_id_type& class_id) + { + load((boost::uint_least16_t&)(class_id)); + } + + void load(boost::serialization::item_version_type& version) + { + load((boost::uint_least32_t&)(version)); + } + + void load(boost::serialization::collection_size_type& version) + { + load((boost::uint_least32_t&)(version)); + } + + void load(boost::archive::object_id_type& object_id) + { + load((boost::uint_least32_t&)(object_id)); + } + + void load(boost::archive::version_type& version) + { + load((boost::uint_least32_t&)(version)); + } +#endif + }; + + // polymorphic portable binary iarchive typdef + typedef POLYMORPHIC(portable_iarchive) polymorphic_portable_iarchive; +#undef POLYMORPHIC + +} // namespace eos + +// this is required by export which registers all of your +// classes with all the inbuilt archives plus our archive. +#if BOOST_VERSION < 103500 +#define BOOST_ARCHIVE_CUSTOM_IARCHIVE_TYPES eos::portable_iarchive +#else +BOOST_SERIALIZATION_REGISTER_ARCHIVE(eos::portable_iarchive) +BOOST_SERIALIZATION_REGISTER_ARCHIVE(eos::polymorphic_portable_iarchive) +#endif + +// if you include this header multiple times and your compiler is picky +// about multiple template instantiations (eg. gcc is) then you need to +// define NO_EXPLICIT_TEMPLATE_INSTANTIATION before every include but one +// or you move the instantiation section into an implementation file +#ifndef NO_EXPLICIT_TEMPLATE_INSTANTIATION + +#include <boost/archive/impl/basic_binary_iarchive.ipp> +#include <boost/archive/impl/basic_binary_iprimitive.ipp> + +#if BOOST_VERSION < 104000 +#include <boost/archive/impl/archive_pointer_iserializer.ipp> +#elif !defined BOOST_ARCHIVE_SERIALIZER_INCLUDED +#include <boost/archive/impl/archive_serializer_map.ipp> +#define BOOST_ARCHIVE_SERIALIZER_INCLUDED +#endif + +namespace boost { namespace archive { + + // explicitly instantiate for this type of binary stream + template class basic_binary_iarchive<eos::portable_iarchive>; + + template class basic_binary_iprimitive< + eos::portable_iarchive +#if BOOST_VERSION < 103400 + , std::istream +#else + , std::istream::char_type + , std::istream::traits_type +#endif + >; + +#if BOOST_VERSION < 104000 + template class detail::archive_pointer_iserializer<eos::portable_iarchive>; +#else + template class detail::archive_serializer_map<eos::portable_iarchive>; + //template class detail::archive_serializer_map<eos::polymorphic_portable_iarchive>; +#endif + + } } // namespace boost::archive + +#endif diff --git a/src/trace/portable_oarchive.hpp b/src/trace/portable_oarchive.hpp index 4e76ae3494863966196cd8c8eb3d0bc201d94295..f1fa7ff41dac68b80f2e8a95be1e25fae5b5accb 100644 --- a/src/trace/portable_oarchive.hpp +++ b/src/trace/portable_oarchive.hpp @@ -1,439 +1,439 @@ -/*****************************************************************************/ -/** - * \file portable_oarchive.hpp - * \brief Provides an archive to create portable binary files. - * \author christian.pfligersdorffer@eos.info - * \version 4.2 - * - * This archive (pair) brings the advantanges of binary streams to the cross - * platform boost::serialization user. While being almost as fast as the native - * binary archive it allows its files to be exchanged between cpu architectures - * using different byte order (endianness). Speaking of speed: in serializing - * numbers the (portable) binary approach is approximately ten times faster than - * the ascii implementation (that is inherently portable)! - * - * Based on the portable archive example by Robert Ramey this implementation - * uses Beman Dawes endian library and fp_utilities from Johan Rade, both being - * in boost since 1.36. Prior to that you need to add them both (header only) - * to your boost directory before you're able to use the archives provided. - * Our archives have been tested successfully for boost versions 1.33 to 1.46! - * - * \note Correct behaviour has so far been confirmed using PowerPC-32, x86-32 - * and x86-64 platforms featuring different byte order. So there is a good - * chance it will instantly work for your specific setup. If you encounter - * problems or have suggestions please contact the author. - * - * \note Version 4.2 maintains compatibility with the latest boost 1.46 and adds - * serialization of special floating point values inf and NaN as proposed - * by Francois Mauger. - * - * \note Version 4.1 makes the archives work together with boost 1.40 and 1.41. - * Thanks to Francois Mauger for his suggestions. - * - * \note Version 4 removes one level of the inheritance hierachy and directly - * builds upon binary primitive and basic binary archive, thereby fixing - * the last open issue regarding array serialization. Thanks to Robert - * Ramey for the hint. - * - * \note A few fixes introduced in version 3.1 let the archives pass all of the - * serialization tests. Thanks to Sergey Morozov for running the tests. - * Wouter Bijlsma pointed out where to find the fp_utilities and endian - * libraries headers inside the boost distribution. I would never have - * found them so thank him it works out of the box since boost 1.36. - * - * \note With Version 3.0 the archives have been made portable across different - * boost versions. For that purpose a header is added to the data that - * supplies the underlying serialization library version. Backwards - * compatibility is maintained by assuming library version boost 1.33 if - * the iarchive is created using the no_header flag. Whether a header is - * present or not can be guessed by peeking into the stream: the header's - * first byte is the magic number 127 coinciding with 'e' | 'o' | 's' :-) - * - * \note Version 2.1 removes several compiler warnings and enhances floating - * point diagnostics to inform the user if some preconditions are violated - * on his platform. We do not strive for the universally portable solution - * in binary floating point serialization as desired by some boost users. - * Instead we support only the most widely used IEEE 754 format and try to - * detect when requirements are not met and hence our approach must fail. - * Contributions we made by Johan Rade and �kos Mar�y. - * - * \note Version 2.0 fixes a serious bug that effectively transformed most - * of negative integral values into positive values! For example the two - * numbers -12 and 234 were stored in the same 8-bit pattern and later - * always restored to 234. This was fixed in this version in a way that - * does not change the interpretation of existing archives that did work - * because there were no negative numbers. The other way round archives - * created by version 2.0 and containing negative numbers will raise an - * integer type size exception when reading it with version 1.0. Thanks - * to Markus Frohnmaier for testing the archives and finding the bug. - * - * \copyright The boost software license applies. - */ -/*****************************************************************************/ - -#pragma once - -#include <ostream> - -// basic headers -#include <boost/version.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/archive/basic_binary_oprimitive.hpp> -#include <boost/archive/basic_binary_oarchive.hpp> - -#if BOOST_VERSION >= 103500 -#include <boost/archive/shared_ptr_helper.hpp> -#endif - -// funny polymorphics -#if BOOST_VERSION < 103500 -#include <boost/archive/detail/polymorphic_oarchive_impl.hpp> -#define POLYMORPHIC(T) boost::archive::detail::polymorphic_oarchive_impl<T> - -#elif BOOST_VERSION < 103600 -#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp> -#define POLYMORPHIC(T) boost::archive::detail::polymorphic_oarchive_dispatch<T> - -#else -#include <boost/archive/detail/polymorphic_oarchive_route.hpp> -#define POLYMORPHIC(T) boost::archive::detail::polymorphic_oarchive_route<T> -#endif - -// endian and fpclassify -#if BOOST_VERSION < 103600 -#include <boost/integer/endian.hpp> -#include <boost/math/fpclassify.hpp> -#elif BOOST_VERSION < 104800 -#include <boost/spirit/home/support/detail/integer/endian.hpp> -#include <boost/spirit/home/support/detail/math/fpclassify.hpp> -#else -#include <boost/spirit/home/support/detail/endian.hpp> -#include <boost/spirit/home/support/detail/math/fpclassify.hpp> -#endif - -// namespace alias -#if BOOST_VERSION < 103800 -namespace fp = boost::math; -#else -namespace fp = boost::spirit::math; -#endif - -// generic type traits for numeric types -#include <boost/type_traits/is_integral.hpp> -#include <boost/type_traits/is_signed.hpp> -#include <boost/type_traits/is_arithmetic.hpp> -#include <boost/type_traits/is_floating_point.hpp> - -#include "portable_archive_exception.hpp" - -// hint from Johan Rade: on VMS there is still support for -// the VAX floating point format and this macro detects it -#if defined(__vms) && defined(__DECCXX) && !__IEEE_FLOAT -#error "VAX floating point format is not supported!" -#endif - -namespace eos { - - // forward declaration - class portable_oarchive; - - typedef boost::archive::basic_binary_oprimitive< - portable_oarchive - #if BOOST_VERSION < 103400 - , std::ostream - #else - , std::ostream::char_type - , std::ostream::traits_type - #endif - > portable_oprimitive; - - /** - * \brief Portable binary output archive using little endian format. - * - * This archive addresses integer size, endianness and floating point types so - * that data can be transferred across different systems. The archive consists - * primarily of three different save implementations for integral types, - * floating point types and string types. Those functions are templates and use - * enable_if to be correctly selected for overloading. - * - * \note The class is based on the portable binary example by Robert Ramey and - * uses Beman Dawes endian library plus fp_utilities by Johan Rade. - */ - class portable_oarchive : public portable_oprimitive - - // the example derives from common_oarchive but that lacks the - // save_override functions so we chose to stay one level higher - , public boost::archive::basic_binary_oarchive<portable_oarchive> - - #if BOOST_VERSION >= 103500 - // mix-in helper class for serializing shared_ptr - , public boost::archive::detail::shared_ptr_helper - #endif - { - // workaround for gcc: use a dummy struct - // as additional argument type for overloading - template<int> struct dummy { dummy(int) {}}; - - // stores a signed char directly to stream - void save_signed_char(const signed char& c) - { - portable_oprimitive::save(c); - } - - // archive initialization - void init(unsigned flags) - { - // it is vital to have version information if the archive is - // to be parsed with a newer version of boost::serialization - // therefor we create a header, no header means boost 1.33 - if (flags & boost::archive::no_header) - BOOST_ASSERT(archive_version == 3); - else - { - // write our minimalistic header (magic byte plus version) - // the boost archives write a string instead - by calling - // boost::archive::basic_binary_oarchive<derived_t>::init() - save_signed_char(magic_byte); - - // write current version -// save<unsigned>(archive_version); - operator<<(archive_version); - } - } - - public: - //! Save string types. - template<class C, class T, class A> - void save(const std::basic_string<C, T, A>& s) - { - // implementation only valid for narrow string - BOOST_STATIC_ASSERT(sizeof(C) == sizeof(char)); - portable_oprimitive::save(s); - } - - //! Saving bool directly, not by const reference - //! because of tracking_type's operator (bool) - void save(bool b) - { - save_signed_char(b); - if (b) save_signed_char('T'); - } - - /** - * \brief Save integer types. - * - * First we save the size information ie. the number of bytes that hold the - * actual data. We subsequently transform the data using store_little_endian - * and store non-zero bytes to the stream. - */ - template <typename T> - typename boost::enable_if<boost::is_integral<T> >::type - save(const T & t, dummy<2> = 0) - { - if (T temp = t) - { - // examine the number of bytes - // needed to represent the number - signed char size = 0; - do { temp >>= CHAR_BIT; ++size; } - while (temp != 0 && temp != (T) -1); - - // encode the sign bit into the size - save_signed_char(t > 0 ? size : -size); - BOOST_ASSERT(t > 0 || boost::is_signed<T>::value); - - // we choose to use little endian because this way we just - // save the first size bytes to the stream and skip the rest - #if BOOST_VERSION < 104800 - boost::detail::store_little_endian<T, sizeof(T)>(&temp, t); - #else - boost::spirit::detail::store_little_endian<T, sizeof(T)>(&temp, t); - #endif - save_binary(&temp, size); - } - // zero optimization - else save_signed_char(0); - } - - /** - * \brief Save floating point types. - * - * We simply rely on fp_traits to extract the bit pattern into an (unsigned) - * integral type and store that into the stream. Francois Mauger provided - * standardized behaviour for special values like inf and NaN, that need to - * be serialized in his application. - * - * \note by Johan Rade (author of the floating point utilities library): - * Be warned that the math::detail::fp_traits<T>::type::get_bits() function - * is *not* guaranteed to give you all bits of the floating point number. It - * will give you all bits if and only if there is an integer type that has - * the same size as the floating point you are copying from. It will not - * give you all bits for double if there is no uint64_t. It will not give - * you all bits for long double if sizeof(long double) > 8 or there is no - * uint64_t. - * - * The member fp_traits<T>::type::coverage will tell you whether all bits - * are copied. This is a typedef for either math::detail::all_bits or - * math::detail::not_all_bits. - * - * If the function does not copy all bits, then it will copy the most - * significant bits. So if you serialize and deserialize the way you - * describe, and fp_traits<T>::type::coverage is math::detail::not_all_bits, - * then your floating point numbers will be truncated. This will introduce - * small rounding off errors. - */ - template <typename T> - typename boost::enable_if<boost::is_floating_point<T> >::type - save(const T & t, dummy<3> = 0) - { - typedef typename fp::detail::fp_traits<T>::type traits; - - // if the no_infnan flag is set we must throw here - if (get_flags() & no_infnan && !fp::isfinite(t)) - throw portable_archive_exception(t); - - // if you end here there are three possibilities: - // 1. you're serializing a long double which is not portable - // 2. you're serializing a double but have no 64 bit integer - // 3. your machine is using an unknown floating point format - // after reading the note above you still might decide to - // deactivate this static assert and try if it works out. - typename traits::bits bits; - BOOST_STATIC_ASSERT(sizeof(bits) == sizeof(T)); - BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_iec559); - - // examine value closely - switch (fp::fpclassify(t)) - { - case FP_ZERO: bits = 0; break; - case FP_NAN: bits = traits::exponent | traits::mantissa; break; - case FP_INFINITE: bits = traits::exponent | (t<0) * traits::sign; break; - case FP_SUBNORMAL: assert(std::numeric_limits<T>::has_denorm); - case FP_NORMAL: traits::get_bits(t, bits); break; - default: throw portable_archive_exception(t); - } - - save(bits); - } - - /** - * \brief Constructor on a stream using ios::binary mode! - * - * We cannot call basic_binary_oprimitive::init which stores type - * sizes to the archive in order to detect tranfers to non-compatible - * platforms. - * - * We could have called basic_binary_oarchive::init which would create - * the boost::serialization standard archive header containing also the - * library version. Due to efficiency we stick with our own. - */ - portable_oarchive(std::ostream& os, unsigned flags = 0) - #if BOOST_VERSION < 103400 - : portable_oprimitive(os, flags & boost::archive::no_codecvt) - #else - : portable_oprimitive(*os.rdbuf(), flags & boost::archive::no_codecvt) - #endif - , boost::archive::basic_binary_oarchive<portable_oarchive>(flags) - { - init(flags); - } - - #if BOOST_VERSION >= 103400 - portable_oarchive(std::streambuf& sb, unsigned flags = 0) - : portable_oprimitive(sb, flags & boost::archive::no_codecvt) - , boost::archive::basic_binary_oarchive<portable_oarchive>(flags) - { - init(flags); - } - #endif - - #if BOOST_VERSION >= 104400 - // in boost 1.44 version_type was splitted into library_version_type and - // item_version_type, plus a whole bunch of additional strong typedefs - void save(const boost::archive::library_version_type& version) - { - save((boost::uint_least16_t)(version)); - } - - void save(const boost::archive::class_id_type& class_id) - { - save((boost::uint_least16_t)(class_id)); // has operator (int) ??! - } - - void save(const boost::serialization::item_version_type& class_id) - { - save((boost::uint_least32_t)(class_id)); - } - - void save(const boost::serialization::collection_size_type& class_id) - { - save((boost::uint_least32_t)(class_id)); - } - - void save(const boost::archive::object_id_type& object_id) - { - save((boost::uint_least32_t)(object_id)); - } - - void save(const boost::archive::version_type& version) - { - save((boost::uint_least32_t)(version)); - } - #endif - }; - - // polymorphic portable binary oarchive typedef - typedef POLYMORPHIC(portable_oarchive) polymorphic_portable_oarchive; - #undef POLYMORPHIC - -} // namespace eos - -// required by export -#if BOOST_VERSION < 103500 -#define BOOST_ARCHIVE_CUSTOM_OARCHIVE_TYPES eos::portable_oarchive -#else -BOOST_SERIALIZATION_REGISTER_ARCHIVE(eos::portable_oarchive) -BOOST_SERIALIZATION_REGISTER_ARCHIVE(eos::polymorphic_portable_oarchive) -#endif - -// if you include this header multiple times and your compiler is picky -// about multiple template instantiations (eg. gcc is) then you need to -// define NO_EXPLICIT_TEMPLATE_INSTANTIATION before every include but one -// or you move the instantiation section into an implementation file -#ifndef NO_EXPLICIT_TEMPLATE_INSTANTIATION - -#include <boost/archive/impl/basic_binary_oarchive.ipp> -#include <boost/archive/impl/basic_binary_oprimitive.ipp> - -#if BOOST_VERSION < 104000 -#include <boost/archive/impl/archive_pointer_oserializer.ipp> -#elif !defined BOOST_ARCHIVE_SERIALIZER_INCLUDED -#include <boost/archive/impl/archive_serializer_map.ipp> -#define BOOST_ARCHIVE_SERIALIZER_INCLUDED -#endif - -namespace boost { namespace archive { - - // explicitly instantiate for this type of binary stream - template class basic_binary_oarchive<eos::portable_oarchive>; - - template class basic_binary_oprimitive< - eos::portable_oarchive - #if BOOST_VERSION < 103400 - , std::ostream - #else - , std::ostream::char_type - , std::ostream::traits_type - #endif - >; - -#if BOOST_VERSION < 104000 - template class detail::archive_pointer_oserializer<eos::portable_oarchive>; -#else - template class detail::archive_serializer_map<eos::portable_oarchive>; - //template class detail::archive_serializer_map<eos::polymorphic_portable_oarchive>; -#endif - -} } // namespace boost::archive - -#endif +/*****************************************************************************/ +/** + * \file portable_oarchive.hpp + * \brief Provides an archive to create portable binary files. + * \author christian.pfligersdorffer@eos.info + * \version 4.2 + * + * This archive (pair) brings the advantanges of binary streams to the cross + * platform boost::serialization user. While being almost as fast as the native + * binary archive it allows its files to be exchanged between cpu architectures + * using different byte order (endianness). Speaking of speed: in serializing + * numbers the (portable) binary approach is approximately ten times faster than + * the ascii implementation (that is inherently portable)! + * + * Based on the portable archive example by Robert Ramey this implementation + * uses Beman Dawes endian library and fp_utilities from Johan Rade, both being + * in boost since 1.36. Prior to that you need to add them both (header only) + * to your boost directory before you're able to use the archives provided. + * Our archives have been tested successfully for boost versions 1.33 to 1.46! + * + * \note Correct behaviour has so far been confirmed using PowerPC-32, x86-32 + * and x86-64 platforms featuring different byte order. So there is a good + * chance it will instantly work for your specific setup. If you encounter + * problems or have suggestions please contact the author. + * + * \note Version 4.2 maintains compatibility with the latest boost 1.46 and adds + * serialization of special floating point values inf and NaN as proposed + * by Francois Mauger. + * + * \note Version 4.1 makes the archives work together with boost 1.40 and 1.41. + * Thanks to Francois Mauger for his suggestions. + * + * \note Version 4 removes one level of the inheritance hierachy and directly + * builds upon binary primitive and basic binary archive, thereby fixing + * the last open issue regarding array serialization. Thanks to Robert + * Ramey for the hint. + * + * \note A few fixes introduced in version 3.1 let the archives pass all of the + * serialization tests. Thanks to Sergey Morozov for running the tests. + * Wouter Bijlsma pointed out where to find the fp_utilities and endian + * libraries headers inside the boost distribution. I would never have + * found them so thank him it works out of the box since boost 1.36. + * + * \note With Version 3.0 the archives have been made portable across different + * boost versions. For that purpose a header is added to the data that + * supplies the underlying serialization library version. Backwards + * compatibility is maintained by assuming library version boost 1.33 if + * the iarchive is created using the no_header flag. Whether a header is + * present or not can be guessed by peeking into the stream: the header's + * first byte is the magic number 127 coinciding with 'e' | 'o' | 's' :-) + * + * \note Version 2.1 removes several compiler warnings and enhances floating + * point diagnostics to inform the user if some preconditions are violated + * on his platform. We do not strive for the universally portable solution + * in binary floating point serialization as desired by some boost users. + * Instead we support only the most widely used IEEE 754 format and try to + * detect when requirements are not met and hence our approach must fail. + * Contributions we made by Johan Rade and �kos Mar�y. + * + * \note Version 2.0 fixes a serious bug that effectively transformed most + * of negative integral values into positive values! For example the two + * numbers -12 and 234 were stored in the same 8-bit pattern and later + * always restored to 234. This was fixed in this version in a way that + * does not change the interpretation of existing archives that did work + * because there were no negative numbers. The other way round archives + * created by version 2.0 and containing negative numbers will raise an + * integer type size exception when reading it with version 1.0. Thanks + * to Markus Frohnmaier for testing the archives and finding the bug. + * + * \copyright The boost software license applies. + */ +/*****************************************************************************/ + +#pragma once + +#include <ostream> + +// basic headers +#include <boost/version.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/archive/basic_binary_oprimitive.hpp> +#include <boost/archive/basic_binary_oarchive.hpp> + +#if BOOST_VERSION >= 103500 +#include <boost/archive/shared_ptr_helper.hpp> +#endif + +// funny polymorphics +#if BOOST_VERSION < 103500 +#include <boost/archive/detail/polymorphic_oarchive_impl.hpp> +#define POLYMORPHIC(T) boost::archive::detail::polymorphic_oarchive_impl<T> + +#elif BOOST_VERSION < 103600 +#include <boost/archive/detail/polymorphic_oarchive_dispatch.hpp> +#define POLYMORPHIC(T) boost::archive::detail::polymorphic_oarchive_dispatch<T> + +#else +#include <boost/archive/detail/polymorphic_oarchive_route.hpp> +#define POLYMORPHIC(T) boost::archive::detail::polymorphic_oarchive_route<T> +#endif + +// endian and fpclassify +#if BOOST_VERSION < 103600 +#include <boost/integer/endian.hpp> +#include <boost/math/fpclassify.hpp> +#elif BOOST_VERSION < 104800 +#include <boost/spirit/home/support/detail/integer/endian.hpp> +#include <boost/spirit/home/support/detail/math/fpclassify.hpp> +#else +#include <boost/spirit/home/support/detail/endian.hpp> +#include <boost/spirit/home/support/detail/math/fpclassify.hpp> +#endif + +// namespace alias +#if BOOST_VERSION < 103800 + namespace fp = boost::math; +#else +namespace fp = boost::spirit::math; +#endif + +// generic type traits for numeric types +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/is_signed.hpp> +#include <boost/type_traits/is_arithmetic.hpp> +#include <boost/type_traits/is_floating_point.hpp> + +#include "portable_archive_exception.hpp" + +// hint from Johan Rade: on VMS there is still support for +// the VAX floating point format and this macro detects it +#if defined(__vms) && defined(__DECCXX) && !__IEEE_FLOAT +#error "VAX floating point format is not supported!" +#endif + +namespace eos { + + // forward declaration + class portable_oarchive; + + typedef boost::archive::basic_binary_oprimitive< + portable_oarchive +#if BOOST_VERSION < 103400 + , std::ostream +#else + , std::ostream::char_type + , std::ostream::traits_type +#endif + > portable_oprimitive; + + /** + * \brief Portable binary output archive using little endian format. + * + * This archive addresses integer size, endianness and floating point types so + * that data can be transferred across different systems. The archive consists + * primarily of three different save implementations for integral types, + * floating point types and string types. Those functions are templates and use + * enable_if to be correctly selected for overloading. + * + * \note The class is based on the portable binary example by Robert Ramey and + * uses Beman Dawes endian library plus fp_utilities by Johan Rade. + */ + class portable_oarchive : public portable_oprimitive + + // the example derives from common_oarchive but that lacks the + // save_override functions so we chose to stay one level higher + , public boost::archive::basic_binary_oarchive<portable_oarchive> + +#if BOOST_VERSION >= 103500 + // mix-in helper class for serializing shared_ptr + , public boost::archive::detail::shared_ptr_helper +#endif + { + // workaround for gcc: use a dummy struct + // as additional argument type for overloading + template<int> struct dummy { dummy(int) {}}; + + // stores a signed char directly to stream + void save_signed_char(const signed char& c) + { + portable_oprimitive::save(c); + } + + // archive initialization + void init(unsigned flags) + { + // it is vital to have version information if the archive is + // to be parsed with a newer version of boost::serialization + // therefor we create a header, no header means boost 1.33 + if (flags & boost::archive::no_header) + BOOST_ASSERT(archive_version == 3); + else + { + // write our minimalistic header (magic byte plus version) + // the boost archives write a string instead - by calling + // boost::archive::basic_binary_oarchive<derived_t>::init() + save_signed_char(magic_byte); + + // write current version + // save<unsigned>(archive_version); + operator<<(archive_version); + } + } + + public: + //! Save string types. + template<class C, class T, class A> + void save(const std::basic_string<C, T, A>& s) + { + // implementation only valid for narrow string + BOOST_STATIC_ASSERT(sizeof(C) == sizeof(char)); + portable_oprimitive::save(s); + } + + //! Saving bool directly, not by const reference + //! because of tracking_type's operator (bool) + void save(bool b) + { + save_signed_char(b); + if (b) save_signed_char('T'); + } + + /** + * \brief Save integer types. + * + * First we save the size information ie. the number of bytes that hold the + * actual data. We subsequently transform the data using store_little_endian + * and store non-zero bytes to the stream. + */ + template <typename T> + typename boost::enable_if<boost::is_integral<T> >::type + save(const T & t, dummy<2> = 0) + { + if (T temp = t) + { + // examine the number of bytes + // needed to represent the number + signed char size = 0; + do { temp >>= CHAR_BIT; ++size; } + while (temp != 0 && temp != (T) -1); + + // encode the sign bit into the size + save_signed_char(t > 0 ? size : -size); + BOOST_ASSERT(t > 0 || boost::is_signed<T>::value); + + // we choose to use little endian because this way we just + // save the first size bytes to the stream and skip the rest +#if BOOST_VERSION < 104800 + boost::detail::store_little_endian<T, sizeof(T)>(&temp, t); +#else + boost::spirit::detail::store_little_endian<T, sizeof(T)>(&temp, t); +#endif + save_binary(&temp, size); + } + // zero optimization + else save_signed_char(0); + } + + /** + * \brief Save floating point types. + * + * We simply rely on fp_traits to extract the bit pattern into an (unsigned) + * integral type and store that into the stream. Francois Mauger provided + * standardized behaviour for special values like inf and NaN, that need to + * be serialized in his application. + * + * \note by Johan Rade (author of the floating point utilities library): + * Be warned that the math::detail::fp_traits<T>::type::get_bits() function + * is *not* guaranteed to give you all bits of the floating point number. It + * will give you all bits if and only if there is an integer type that has + * the same size as the floating point you are copying from. It will not + * give you all bits for double if there is no uint64_t. It will not give + * you all bits for long double if sizeof(long double) > 8 or there is no + * uint64_t. + * + * The member fp_traits<T>::type::coverage will tell you whether all bits + * are copied. This is a typedef for either math::detail::all_bits or + * math::detail::not_all_bits. + * + * If the function does not copy all bits, then it will copy the most + * significant bits. So if you serialize and deserialize the way you + * describe, and fp_traits<T>::type::coverage is math::detail::not_all_bits, + * then your floating point numbers will be truncated. This will introduce + * small rounding off errors. + */ + template <typename T> + typename boost::enable_if<boost::is_floating_point<T> >::type + save(const T & t, dummy<3> = 0) + { + typedef typename fp::detail::fp_traits<T>::type traits; + + // if the no_infnan flag is set we must throw here + if (get_flags() & no_infnan && !fp::isfinite(t)) + throw portable_archive_exception(t); + + // if you end here there are three possibilities: + // 1. you're serializing a long double which is not portable + // 2. you're serializing a double but have no 64 bit integer + // 3. your machine is using an unknown floating point format + // after reading the note above you still might decide to + // deactivate this static assert and try if it works out. + typename traits::bits bits; + BOOST_STATIC_ASSERT(sizeof(bits) == sizeof(T)); + BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_iec559); + + // examine value closely + switch (fp::fpclassify(t)) + { + case FP_ZERO: bits = 0; break; + case FP_NAN: bits = traits::exponent | traits::mantissa; break; + case FP_INFINITE: bits = traits::exponent | (t<0) * traits::sign; break; + case FP_SUBNORMAL: assert(std::numeric_limits<T>::has_denorm); + case FP_NORMAL: traits::get_bits(t, bits); break; + default: throw portable_archive_exception(t); + } + + save(bits); + } + + /** + * \brief Constructor on a stream using ios::binary mode! + * + * We cannot call basic_binary_oprimitive::init which stores type + * sizes to the archive in order to detect tranfers to non-compatible + * platforms. + * + * We could have called basic_binary_oarchive::init which would create + * the boost::serialization standard archive header containing also the + * library version. Due to efficiency we stick with our own. + */ + portable_oarchive(std::ostream& os, unsigned flags = 0) +#if BOOST_VERSION < 103400 + : portable_oprimitive(os, flags & boost::archive::no_codecvt) +#else + : portable_oprimitive(*os.rdbuf(), flags & boost::archive::no_codecvt) +#endif + , boost::archive::basic_binary_oarchive<portable_oarchive>(flags) + { + init(flags); + } + +#if BOOST_VERSION >= 103400 + portable_oarchive(std::streambuf& sb, unsigned flags = 0) + : portable_oprimitive(sb, flags & boost::archive::no_codecvt) + , boost::archive::basic_binary_oarchive<portable_oarchive>(flags) + { + init(flags); + } +#endif + +#if BOOST_VERSION >= 104400 + // in boost 1.44 version_type was splitted into library_version_type and + // item_version_type, plus a whole bunch of additional strong typedefs + void save(const boost::archive::library_version_type& version) + { + save((boost::uint_least16_t)(version)); + } + + void save(const boost::archive::class_id_type& class_id) + { + save((boost::uint_least16_t)(class_id)); // has operator (int) ??! + } + + void save(const boost::serialization::item_version_type& class_id) + { + save((boost::uint_least32_t)(class_id)); + } + + void save(const boost::serialization::collection_size_type& class_id) + { + save((boost::uint_least32_t)(class_id)); + } + + void save(const boost::archive::object_id_type& object_id) + { + save((boost::uint_least32_t)(object_id)); + } + + void save(const boost::archive::version_type& version) + { + save((boost::uint_least32_t)(version)); + } +#endif + }; + + // polymorphic portable binary oarchive typedef + typedef POLYMORPHIC(portable_oarchive) polymorphic_portable_oarchive; +#undef POLYMORPHIC + +} // namespace eos + +// required by export +#if BOOST_VERSION < 103500 +#define BOOST_ARCHIVE_CUSTOM_OARCHIVE_TYPES eos::portable_oarchive +#else +BOOST_SERIALIZATION_REGISTER_ARCHIVE(eos::portable_oarchive) +BOOST_SERIALIZATION_REGISTER_ARCHIVE(eos::polymorphic_portable_oarchive) +#endif + +// if you include this header multiple times and your compiler is picky +// about multiple template instantiations (eg. gcc is) then you need to +// define NO_EXPLICIT_TEMPLATE_INSTANTIATION before every include but one +// or you move the instantiation section into an implementation file +#ifndef NO_EXPLICIT_TEMPLATE_INSTANTIATION + +#include <boost/archive/impl/basic_binary_oarchive.ipp> +#include <boost/archive/impl/basic_binary_oprimitive.ipp> + +#if BOOST_VERSION < 104000 +#include <boost/archive/impl/archive_pointer_oserializer.ipp> +#elif !defined BOOST_ARCHIVE_SERIALIZER_INCLUDED +#include <boost/archive/impl/archive_serializer_map.ipp> +#define BOOST_ARCHIVE_SERIALIZER_INCLUDED +#endif + +namespace boost { namespace archive { + + // explicitly instantiate for this type of binary stream + template class basic_binary_oarchive<eos::portable_oarchive>; + + template class basic_binary_oprimitive< + eos::portable_oarchive +#if BOOST_VERSION < 103400 + , std::ostream +#else + , std::ostream::char_type + , std::ostream::traits_type +#endif + >; + +#if BOOST_VERSION < 104000 + template class detail::archive_pointer_oserializer<eos::portable_oarchive>; +#else + template class detail::archive_serializer_map<eos::portable_oarchive>; + //template class detail::archive_serializer_map<eos::polymorphic_portable_oarchive>; +#endif + + } } // namespace boost::archive + +#endif diff --git a/tests/parser/test_token.cpp b/tests/parser/test_token.cpp index bd4dab0651a228727ece4a71a2ee74e371244be3..6d857df9453bc3d1f36d0257bf23ca0564a3cd82 100644 --- a/tests/parser/test_token.cpp +++ b/tests/parser/test_token.cpp @@ -1,68 +1,68 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#include <iostream> -#include "../../src/parser/TokenSource.hpp" -#include <fstream> - - -using namespace std; -//test de lexer -int main(int argc, char** argv) -{ - - TokenSource source; - if (argc<2) - source.open("trace_to_parse.trace"); - else - source.open(argv[1]); - - std::string* token; - int i=0; - while ((token=source.read_token())!=NULL) - { - i++; - std::cout<<"-"<<*token<<"-"<<endl; - } - std::cout<<"token lu :"<<i<<"_"<<endl; - return 0; -} + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#include <iostream> +#include "../../src/parser/TokenSource.hpp" +#include <fstream> + + +using namespace std; +//test de lexer +int main(int argc, char** argv) +{ + + TokenSource source; + if (argc<2) + source.open("trace_to_parse.trace"); + else + source.open(argv[1]); + + std::string* token; + int i=0; + while ((token=source.read_token())!=NULL) + { + i++; + std::cout<<"-"<<*token<<"-"<<endl; + } + std::cout<<"token lu :"<<i<<"_"<<endl; + return 0; +} diff --git a/tests/stubs/Color.cpp b/tests/stubs/Color.cpp index 7d37ec9d65022ef4c4bdca810d7949387d59ad20..dafdaa8df1d404772d9f29e5b2699c3471063ed9 100644 --- a/tests/stubs/Color.cpp +++ b/tests/stubs/Color.cpp @@ -1,55 +1,55 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#include "Color.hpp" - -Color::Color(){ - me.erase(); -} -std::string Color::to_string() const{ - return me; -} - -bool Color::instantiate(const std::string &in, Color &out) { - std::cout << "instantiate : " << in << " in color" << std::endl; - return true; -} + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#include "Color.hpp" + +Color::Color(){ + me.erase(); +} +std::string Color::to_string() const{ + return me; +} + +bool Color::instantiate(const std::string &in, Color &out) { + std::cout << "instantiate : " << in << " in color" << std::endl; + return true; +} diff --git a/tests/stubs/Color.hpp b/tests/stubs/Color.hpp index e1c5adb5feb615fb7f0c4548e7e330e9d62cf5b1..55e3274dd77c0dd394754fb60b46dc09ddb367f9 100644 --- a/tests/stubs/Color.hpp +++ b/tests/stubs/Color.hpp @@ -1,80 +1,80 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#ifndef COLOR_HPP -#define COLOR_HPP - -#include <iostream> -#include "Value.hpp" - -/*! - * - * \file Color.hpp - * \author NOISETTE - * \brief Bouchon - * - */ - -class Color : public Value{ -private: - std::string me; - -public: - Color(); - - std::string to_string() const; - - - /*! - * - * \fn instantiate(const std::string &in, Color &out) - * \brief Convert a string to a Color - * \param in String to convert - * \param out Color to be initialized - * \return true, if the conversion succeeded - * - */ - static bool instantiate(const std::string &in, Color &out); -}; - - -#endif // COLOR_HPP + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#ifndef COLOR_HPP +#define COLOR_HPP + +#include <iostream> +#include "Value.hpp" + +/*! + * + * \file Color.hpp + * \author NOISETTE + * \brief Bouchon + * + */ + +class Color : public Value{ +private: + std::string me; + +public: + Color(); + + std::string to_string() const; + + + /*! + * + * \fn instantiate(const std::string &in, Color &out) + * \brief Convert a string to a Color + * \param in String to convert + * \param out Color to be initialized + * \return true, if the conversion succeeded + * + */ + static bool instantiate(const std::string &in, Color &out); +}; + + +#endif // COLOR_HPP diff --git a/tests/stubs/Date.cpp b/tests/stubs/Date.cpp index 4495e830b8be9a4f97c1dd5569b56f050dddd7c7..97bd66f05b928842d16e59c1de15f37c6a5d47ab 100644 --- a/tests/stubs/Date.cpp +++ b/tests/stubs/Date.cpp @@ -1,55 +1,55 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#include "Date.hpp" - -Date::Date(){ - me.erase(); -} -std::string Date::to_string() const{ - return me; -} - -bool Date::instantiate(const std::string &in, Date &out){ - std::cout << "instantiate " << in << " in date" << std::endl; - return true; -} + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#include "Date.hpp" + +Date::Date(){ + me.erase(); +} +std::string Date::to_string() const{ + return me; +} + +bool Date::instantiate(const std::string &in, Date &out){ + std::cout << "instantiate " << in << " in date" << std::endl; + return true; +} diff --git a/tests/stubs/Date.hpp b/tests/stubs/Date.hpp index 7ec5a37e7e02b4f75e05a288d4571d02fa3f9436..9ff98399e14d610cf045cf2cc5363f77abd2fc41 100644 --- a/tests/stubs/Date.hpp +++ b/tests/stubs/Date.hpp @@ -1,79 +1,79 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#ifndef DATE_HPP -#define DATE_HPP - -#include <iostream> -#include "Value.hpp" - -/*! - * - * \file date.hpp - * \author NOISETTE - * \brief Bouchon - * - */ - -class Date : public Value{ -private: - std::string me; - -public: - Date(); - std::string to_string() const; - - /*! - * - * \fn instantiate(const std::string &in, Date &out) - * \brief Convert a string to a Date - * \param in String to convert - * \param out Date to be initialized - * \return true, if the conversion succeeded - * - */ - static bool instantiate(const std::string &in, Date &out); - -}; - - -#endif // DATE_HPP + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#ifndef DATE_HPP +#define DATE_HPP + +#include <iostream> +#include "Value.hpp" + +/*! + * + * \file date.hpp + * \author NOISETTE + * \brief Bouchon + * + */ + +class Date : public Value{ +private: + std::string me; + +public: + Date(); + std::string to_string() const; + + /*! + * + * \fn instantiate(const std::string &in, Date &out) + * \brief Convert a string to a Date + * \param in String to convert + * \param out Date to be initialized + * \return true, if the conversion succeeded + * + */ + static bool instantiate(const std::string &in, Date &out); + +}; + + +#endif // DATE_HPP diff --git a/tests/stubs/Double.cpp b/tests/stubs/Double.cpp index cf4a088901d1e130e259ee1352a7badf6aca704e..6ba0ce5a9cb05c5d3c7335e2791972e24d161810 100644 --- a/tests/stubs/Double.cpp +++ b/tests/stubs/Double.cpp @@ -1,55 +1,55 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#include "Double.hpp" - -Double::Double(){ - me.erase(); -} -std::string Double::to_string() const{ - return me; -} - -bool Double::instantiate(const std::string &in, Double &out){ - std::cout << "instantiate " << in << " in double" << std::endl; - return true; -} + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#include "Double.hpp" + +Double::Double(){ + me.erase(); +} +std::string Double::to_string() const{ + return me; +} + +bool Double::instantiate(const std::string &in, Double &out){ + std::cout << "instantiate " << in << " in double" << std::endl; + return true; +} diff --git a/tests/stubs/Double.hpp b/tests/stubs/Double.hpp index 433dc99adcaaf3d94e712766dc20a6a334a473de..17569cdb069f4ceb4014e659cc84740354237b46 100644 --- a/tests/stubs/Double.hpp +++ b/tests/stubs/Double.hpp @@ -1,79 +1,79 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#ifndef DOUBLE_HPP -#define DOUBLE_HPP - -#include <iostream> -#include "Value.hpp" - -/*! - * - * \file Double.hpp - * \author NOISETTE - * \brief Bouchon - * - */ - -class Double : public Value{ -private: - std::string me; - -public: - Double(); - std::string to_string() const; - - /*! - * - * \fn instantiate(const std::string &in, Double &out) - * \brief Convert a string to a Double - * \param in String to convert - * \param out Double to be initialized - * \return true, if the conversion succeeded - * - */ - static bool instantiate(const std::string &in, Double &out); - -}; - - -#endif // DOUBLE_HPP + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#ifndef DOUBLE_HPP +#define DOUBLE_HPP + +#include <iostream> +#include "Value.hpp" + +/*! + * + * \file Double.hpp + * \author NOISETTE + * \brief Bouchon + * + */ + +class Double : public Value{ +private: + std::string me; + +public: + Double(); + std::string to_string() const; + + /*! + * + * \fn instantiate(const std::string &in, Double &out) + * \brief Convert a string to a Double + * \param in String to convert + * \param out Double to be initialized + * \return true, if the conversion succeeded + * + */ + static bool instantiate(const std::string &in, Double &out); + +}; + + +#endif // DOUBLE_HPP diff --git a/tests/stubs/Hex.cpp b/tests/stubs/Hex.cpp index b3cec482b1393975e394c4466f01c44e7bb967ff..ee506e481e399399e7ac732ec78a3ba6f1ec9b91 100644 --- a/tests/stubs/Hex.cpp +++ b/tests/stubs/Hex.cpp @@ -1,55 +1,55 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#include "Hex.hpp" - -Hex::Hex(){ - me.erase(); -} -std::string Hex::to_string() const{ - return me; -} - -bool Hex::instantiate(const std::string &in, Hex &out){ - std::cout << "instantiate " << in << " in hex" << std::endl; - return true; -} + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#include "Hex.hpp" + +Hex::Hex(){ + me.erase(); +} +std::string Hex::to_string() const{ + return me; +} + +bool Hex::instantiate(const std::string &in, Hex &out){ + std::cout << "instantiate " << in << " in hex" << std::endl; + return true; +} diff --git a/tests/stubs/Hex.hpp b/tests/stubs/Hex.hpp index 398b01c082cd6253d65036619f252f086d3f57f9..939436ca64ce6911104997012ff868ab120802c4 100644 --- a/tests/stubs/Hex.hpp +++ b/tests/stubs/Hex.hpp @@ -1,77 +1,77 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#ifndef HEX_HPP -#define HEX_HPP - -#include <iostream> -#include "Value.hpp" - -/*! - * - * \file hex.hpp - * \author NOISETTE - * \brief Bouchon - * - */ - -class Hex : public Value{ -private: - std::string me; - -public: - Hex(); - std::string to_string() const; - /*! - * - * \fn instantiate(const std::string &in, &out) - * \brief Convert a string to a Hex - * \param in String to convert - * \param out Hex to be initialized - * \return true, if the conversion succeeded - * - */ - static bool instantiate(const std::string &in, Hex &out); -}; - - -#endif // HEX_HPP + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#ifndef HEX_HPP +#define HEX_HPP + +#include <iostream> +#include "Value.hpp" + +/*! + * + * \file hex.hpp + * \author NOISETTE + * \brief Bouchon + * + */ + +class Hex : public Value{ +private: + std::string me; + +public: + Hex(); + std::string to_string() const; + /*! + * + * \fn instantiate(const std::string &in, &out) + * \brief Convert a string to a Hex + * \param in String to convert + * \param out Hex to be initialized + * \return true, if the conversion succeeded + * + */ + static bool instantiate(const std::string &in, Hex &out); +}; + + +#endif // HEX_HPP diff --git a/tests/stubs/Integer.cpp b/tests/stubs/Integer.cpp index 1f5b48393c8a0abdd8344cf7e93feaaaaa8e8289..b152ab6b58f0bc840ca8ce913db8f2b2b20c127d 100644 --- a/tests/stubs/Integer.cpp +++ b/tests/stubs/Integer.cpp @@ -1,55 +1,55 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#include "Integer.hpp" - -Integer::Integer(){ - me.erase(); -} -std::string Integer::to_string() const{ - return me; -} - -bool Integer::instantiate(const std::string &in, Integer &out){ - std::cout << "instantiate " << in << " in integer" << std::endl; - return true; -} + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#include "Integer.hpp" + +Integer::Integer(){ + me.erase(); +} +std::string Integer::to_string() const{ + return me; +} + +bool Integer::instantiate(const std::string &in, Integer &out){ + std::cout << "instantiate " << in << " in integer" << std::endl; + return true; +} diff --git a/tests/stubs/Integer.hpp b/tests/stubs/Integer.hpp index 8f14e0f6878d6a57bc05328c7102ad8883caeef1..97357b1ce8f554c6d66d3cefdc4c998550cc457c 100644 --- a/tests/stubs/Integer.hpp +++ b/tests/stubs/Integer.hpp @@ -1,77 +1,77 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#ifndef INTEGER_HPP -#define INTEGER_HPP - -#include <iostream> -#include "Value.hpp" - -/*! - * - * \file Integer.hpp - * \author NOISETTE - * \brief Bouchon - * - */ - -class Integer : public Value{ -private: - std::string me; - -public: - Integer(); - std::string to_string() const; - /*! - * - * \fn instantiate(const std::string &in, Double &out) - * \brief Convert a string to a Double - * \param in String to convert - * \param out Double to be initialized - * \return true, if the conversion succeeded - * - */ - static bool instantiate(const std::string &in, Integer &out); -}; - - -#endif // INTEGER_HPP + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#ifndef INTEGER_HPP +#define INTEGER_HPP + +#include <iostream> +#include "Value.hpp" + +/*! + * + * \file Integer.hpp + * \author NOISETTE + * \brief Bouchon + * + */ + +class Integer : public Value{ +private: + std::string me; + +public: + Integer(); + std::string to_string() const; + /*! + * + * \fn instantiate(const std::string &in, Double &out) + * \brief Convert a string to a Double + * \param in String to convert + * \param out Double to be initialized + * \return true, if the conversion succeeded + * + */ + static bool instantiate(const std::string &in, Integer &out); +}; + + +#endif // INTEGER_HPP diff --git a/tests/stubs/Name.cpp b/tests/stubs/Name.cpp index 7aea6a50fea76cf6d0eab20acae0973786568eb0..e46ddfb06a66316eb06bd938c42cc31137519951 100644 --- a/tests/stubs/Name.cpp +++ b/tests/stubs/Name.cpp @@ -1,66 +1,65 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#include "Name.hpp" - -Name::Name(){ - me.erase(); -} - -std::string Name::to_string() const{ - return me; -} - - -void Name::set_alias(std::string alias) { - me = alias; -} - - -void Name::set_name(std::string name) { - me = name; -} - -String Name::to_String(){ - return String(me); -} - + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#include "Name.hpp" + +Name::Name(){ + me.erase(); +} + +std::string Name::to_string() const{ + return me; +} + + +void Name::set_alias(std::string alias) { + me = alias; +} + + +void Name::set_name(std::string name) { + me = name; +} + +String Name::to_String(){ + return String(me); +} diff --git a/tests/stubs/Name.hpp b/tests/stubs/Name.hpp index c8f2a3b63b9565ca1fd1f430d67a4d6a1c0f43a3..7fb4786118009b48426477afb421aa8e23f3bdf7 100644 --- a/tests/stubs/Name.hpp +++ b/tests/stubs/Name.hpp @@ -1,71 +1,71 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#ifndef NAME_HPP -#define NAME_HPP - -#include <iostream> -#include "Value.hpp" -#include "String.hpp" -/*! - * - * \file name.hpp - * \author NOISETTE - * \brief Bouchon - * - */ -class Name : public Value{ -private: - std::string me; - -public: - Name(); - std::string to_string() const; - - void set_alias(std::string alias); - void set_name(std::string name); - - String to_String(); -}; - - -#endif // NAME_HPP + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#ifndef NAME_HPP +#define NAME_HPP + +#include <iostream> +#include "Value.hpp" +#include "String.hpp" +/*! + * + * \file name.hpp + * \author NOISETTE + * \brief Bouchon + * + */ +class Name : public Value{ +private: + std::string me; + +public: + Name(); + std::string to_string() const; + + void set_alias(std::string alias); + void set_name(std::string name); + + String to_String(); +}; + + +#endif // NAME_HPP diff --git a/tests/stubs/String.cpp b/tests/stubs/String.cpp index 001bf2057b028819a1257557dd22b399eb7e5cc8..7416c77cb3c71dde7448590b7e62013881bed4e0 100644 --- a/tests/stubs/String.cpp +++ b/tests/stubs/String.cpp @@ -1,61 +1,61 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#include "String.hpp" - -String::String(){ - me.erase(); -} - -String::String(std::string& s){ - me = s; -} - - -std::string String::to_string() const{ - return me; -} - -String String::operator =(const std::string &s){ - me = s; - return *this; -} + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#include "String.hpp" + +String::String(){ + me.erase(); +} + +String::String(std::string& s){ + me = s; +} + + +std::string String::to_string() const{ + return me; +} + +String String::operator =(const std::string &s){ + me = s; + return *this; +} diff --git a/tests/stubs/String.hpp b/tests/stubs/String.hpp index a7c34b0d772384e360676b02412424bbe5e7f0e1..55a4c5c2a7019e3a50c97e391a91863ca7a51df9 100644 --- a/tests/stubs/String.hpp +++ b/tests/stubs/String.hpp @@ -1,77 +1,77 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#ifndef STRING_HPP -#define STRING_HPP - -#include <iostream> -#include "Value.hpp" - -/*! - * - * \file string.hpp - * \author NOISETTE - * \brief Bouchon - * - */ -class String : public Value{ -private: - std::string me; - -public: - String(); - String(std::string &); - /*! - * \fn to_string() const - */ - std::string to_string() const; - - /*! - * \fn operator= (const std::string &) - * \return this String with the new value. - */ - String operator= (const std::string &); - -}; - - -#endif // STRING_HPP + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#ifndef STRING_HPP +#define STRING_HPP + +#include <iostream> +#include "Value.hpp" + +/*! + * + * \file string.hpp + * \author NOISETTE + * \brief Bouchon + * + */ +class String : public Value{ +private: + std::string me; + +public: + String(); + String(std::string &); + /*! + * \fn to_string() const + */ + std::string to_string() const; + + /*! + * \fn operator= (const std::string &) + * \return this String with the new value. + */ + String operator= (const std::string &); + +}; + + +#endif // STRING_HPP diff --git a/tests/stubs/Trace.cpp b/tests/stubs/Trace.cpp index 961dadf62db73c11e921995fd14a2d9831878823..bd4fe37d2b45ebdabedeb6fc341a3885ad33823f 100644 --- a/tests/stubs/Trace.cpp +++ b/tests/stubs/Trace.cpp @@ -1,434 +1,434 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ - -/*! - * - * \file Trace.hpp - * \author NOISETTE - * \brief Bouchon - * - */ -#include "Trace.hpp" - -using namespace std; - - -Trace::Trace(){ - -} -Trace::~Trace(){ - free_str(); -} - -string Trace::to_string(std::map<std::string, Value *> extra_fields){ - string *res =new string( "option()");/* - if (extra_fields.size()>0){ - *res = "option(" ; - for (unsigned int i=0;i<extra_fields.size();i++) - (*res).append(extra_fields[i]->to_string() + " "); - (*res).append(")"); - } - else{ - (*res).assign("\0"); - } - */ - to_freed.push_back(res); - return *res; -} - - -void Trace::free_str(){ - for (unsigned int i = 0 ; i < to_freed.size() ; i ++) - delete to_freed[i]; - - if (!to_freed.empty()) - to_freed.clear(); - -} - -void Trace::define_container_type(Name &alias, ContainerType *container_type_parent, std::map<std::string, Value *> extra_fields){ - cout << "define_container_type " - << alias.to_string() - << " " - << *container_type_parent - << " " - << to_string(extra_fields) - << endl; - - free_str(); -} - - - -void Trace::create_container(Date time, Name alias, ContainerType *type, Container *parent, map<string, Value *> extra_fields){ - cout << "create_container " - << time.to_string() - << " " - << alias.to_string() - << " " - << *type - << " " - << *parent - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - - -void Trace::destroy_container(Date time, Container *cont, ContainerType *type, map<string, Value *> extra_fields){ - cout << "destroy_container " - << time.to_string() - << " " - << *cont - << " " - << *type - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - -void Trace::define_event_type(Name alias, ContainerType *container_type, map<string, Value *> extra_fields){ - cout << "define_event_type " - << alias.to_string() - << " " - << *container_type - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - - -void Trace::define_state_type(Name alias, ContainerType *container_type, map<string, Value *> extra_fields){ - cout << "define_state_type " - << alias.to_string() - << " " - << *container_type - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - -void Trace::define_variable_type(Name alias, ContainerType *container_type, map<string, Value *> extra_fields){ - cout << "define_variable_type " - << alias.to_string() - << " " - << *container_type - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - - -void Trace::define_link_type(Name alias, ContainerType *ancestor, ContainerType *source, ContainerType *destination, map<string, Value *> extra_fields){ - cout << "define_link_type " - << alias.to_string() - << " " - << *ancestor - << " " - << *source - << " " - << *destination - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - - -void Trace::define_entity_value(Name alias, EntityType *entity_type, map<string, Value *> extra_fields){ - cout << "define_entity_value " - << alias.to_string() - << " " - << *entity_type - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - - -void Trace::set_state(Date time, StateType *type, Container *container, EntityValue *value, std::map<std::string, Value *> extra_fields){ - cout << "set_state " - << time.to_string() - << " " - << *type - << " " - << *container - << " " - << *value - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - - -void Trace::push_state(Date time, StateType *type, Container *container, EntityValue *value, map<string, Value *> extra_fields){ - cout << "push_state " - << time.to_string() - << " " - << *type - << " " - << *container - << " " - << *value - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - - -void Trace::pop_state(Date time, StateType *type, Container *container, map<string, Value *> extra_fields){ - - cout << "pop_state " - << time.to_string() - << " " - << *type - << " " - << *container - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - - -void Trace::new_event(Date time, EventType *type, Container *container, EntityValue *value, map<string, Value *> extra_fields){ - cout << "new_event " - << time.to_string() - << " " - << *type - << " " - << *container - << " " - << *value - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - - -void Trace::set_variable(Date time, VariableType *type, Container *container, Double value, map<string, Value *> extra_fields){ - - cout << "set_variable " - << time.to_string() - << " " - << *type - << " " - << *container - << " " - << value.to_string() - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - -void Trace::add_variable(Date time, VariableType *type, Container *container, Double value, map<string, Value *> extra_fields){ - - cout << "add_variable " - << time.to_string() - << " " - << *type - << " " - << *container - << " " - << value.to_string() - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - - -void Trace::sub_variable(Date time, VariableType *type, Container *container, Double value, map<string, Value *> extra_fields){ - - cout << "sub_variable " - << time.to_string() - << " " - << *type - << " " - << *container - << " " - << value.to_string() - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - -void Trace::start_link(Date &time, LinkType *type, Container *ancestor, Container *source, EntityValue *value, String key, std::map<std::string, Value *> extra_fields){ - - cout << "start_link " - << time.to_string() - << " " - << *type - << " " - << *ancestor - << " " - << *source - << " " - << *value - << " " - << key.to_string() - << " " - << to_string(extra_fields) - << endl; - free_str(); - -} - - - -void Trace::end_link(Date &time, LinkType *type, Container *ancestor, Container *destination, EntityValue *value, String key, std::map<std::string, Value *> extra_fields){ - - cout << "end_link " - << time.to_string() - << " " - << *type - << " " - << *ancestor - << " " - << *destination - << " " - << *value - << " " - << key.to_string() - << " " - << to_string(extra_fields) - << endl; - free_str(); -} - - - - - -Container *Trace::search_container_type(String name) const{ - string *res = new string((string)"search(" + name.to_string() + ")"); - to_freed.push_back(res); - return res; -} - - -Container *Trace::search_container(String name) const{ - string* res = new string((string)"search(" + name.to_string() + ")"); - to_freed.push_back(res); - return res; -} - -Container *Trace::search_container(string name) const{ - string* res = new string((string)"search(" + name + ")"); - to_freed.push_back(res); - return res; -} - - -Container *Trace::search_event_type(String name){ - string* res = new string((string)"search(" + name.to_string() + ")"); - to_freed.push_back(res); - return res; -} - - - -Container *Trace::search_state_type(String name){ - string* res = new string("search(" + name.to_string() + ")"); - to_freed.push_back(res); - return res; -} - - - -VariableType *Trace::search_variable_type(String name){ - string* res = new string("search(" + name.to_string() + ")"); - to_freed.push_back(res); - return res; -} - - - -LinkType *Trace::search_link_type(String name){ - string* res = new string((string)"search(" + name.to_string() + ")"); - to_freed.push_back(res); - return res; -} - - - -EntityValue *Trace::search_entity_value(String name, EntityType *entity_type) const{ - string* res = new string((string)"search(" + name.to_string() + ")"); - to_freed.push_back(res); - return res; -} - -EntityType *Trace::search_entity_type(String name) const{ - string* res = new string((string)"search(" + name.to_string() + ")"); - to_freed.push_back(res); - return res; -} - -void Trace::finish(){ - cout << "finish" << endl; -} + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ + +/*! + * + * \file Trace.hpp + * \author NOISETTE + * \brief Bouchon + * + */ +#include "Trace.hpp" + +using namespace std; + + +Trace::Trace(){ + +} +Trace::~Trace(){ + free_str(); +} + +string Trace::to_string(std::map<std::string, Value *> extra_fields){ + string *res =new string( "option()");/* + if (extra_fields.size()>0){ + *res = "option(" ; + for (unsigned int i=0;i<extra_fields.size();i++) + (*res).append(extra_fields[i]->to_string() + " "); + (*res).append(")"); + } + else{ + (*res).assign("\0"); + } + */ + to_freed.push_back(res); + return *res; +} + + +void Trace::free_str(){ + for (unsigned int i = 0 ; i < to_freed.size() ; i ++) + delete to_freed[i]; + + if (!to_freed.empty()) + to_freed.clear(); + +} + +void Trace::define_container_type(Name &alias, ContainerType *container_type_parent, std::map<std::string, Value *> extra_fields){ + cout << "define_container_type " + << alias.to_string() + << " " + << *container_type_parent + << " " + << to_string(extra_fields) + << endl; + + free_str(); +} + + + +void Trace::create_container(Date time, Name alias, ContainerType *type, Container *parent, map<string, Value *> extra_fields){ + cout << "create_container " + << time.to_string() + << " " + << alias.to_string() + << " " + << *type + << " " + << *parent + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + + +void Trace::destroy_container(Date time, Container *cont, ContainerType *type, map<string, Value *> extra_fields){ + cout << "destroy_container " + << time.to_string() + << " " + << *cont + << " " + << *type + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + +void Trace::define_event_type(Name alias, ContainerType *container_type, map<string, Value *> extra_fields){ + cout << "define_event_type " + << alias.to_string() + << " " + << *container_type + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + + +void Trace::define_state_type(Name alias, ContainerType *container_type, map<string, Value *> extra_fields){ + cout << "define_state_type " + << alias.to_string() + << " " + << *container_type + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + +void Trace::define_variable_type(Name alias, ContainerType *container_type, map<string, Value *> extra_fields){ + cout << "define_variable_type " + << alias.to_string() + << " " + << *container_type + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + + +void Trace::define_link_type(Name alias, ContainerType *ancestor, ContainerType *source, ContainerType *destination, map<string, Value *> extra_fields){ + cout << "define_link_type " + << alias.to_string() + << " " + << *ancestor + << " " + << *source + << " " + << *destination + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + + +void Trace::define_entity_value(Name alias, EntityType *entity_type, map<string, Value *> extra_fields){ + cout << "define_entity_value " + << alias.to_string() + << " " + << *entity_type + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + + +void Trace::set_state(Date time, StateType *type, Container *container, EntityValue *value, std::map<std::string, Value *> extra_fields){ + cout << "set_state " + << time.to_string() + << " " + << *type + << " " + << *container + << " " + << *value + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + + +void Trace::push_state(Date time, StateType *type, Container *container, EntityValue *value, map<string, Value *> extra_fields){ + cout << "push_state " + << time.to_string() + << " " + << *type + << " " + << *container + << " " + << *value + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + + +void Trace::pop_state(Date time, StateType *type, Container *container, map<string, Value *> extra_fields){ + + cout << "pop_state " + << time.to_string() + << " " + << *type + << " " + << *container + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + + +void Trace::new_event(Date time, EventType *type, Container *container, EntityValue *value, map<string, Value *> extra_fields){ + cout << "new_event " + << time.to_string() + << " " + << *type + << " " + << *container + << " " + << *value + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + + +void Trace::set_variable(Date time, VariableType *type, Container *container, Double value, map<string, Value *> extra_fields){ + + cout << "set_variable " + << time.to_string() + << " " + << *type + << " " + << *container + << " " + << value.to_string() + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + +void Trace::add_variable(Date time, VariableType *type, Container *container, Double value, map<string, Value *> extra_fields){ + + cout << "add_variable " + << time.to_string() + << " " + << *type + << " " + << *container + << " " + << value.to_string() + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + + +void Trace::sub_variable(Date time, VariableType *type, Container *container, Double value, map<string, Value *> extra_fields){ + + cout << "sub_variable " + << time.to_string() + << " " + << *type + << " " + << *container + << " " + << value.to_string() + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + +void Trace::start_link(Date &time, LinkType *type, Container *ancestor, Container *source, EntityValue *value, String key, std::map<std::string, Value *> extra_fields){ + + cout << "start_link " + << time.to_string() + << " " + << *type + << " " + << *ancestor + << " " + << *source + << " " + << *value + << " " + << key.to_string() + << " " + << to_string(extra_fields) + << endl; + free_str(); + +} + + + +void Trace::end_link(Date &time, LinkType *type, Container *ancestor, Container *destination, EntityValue *value, String key, std::map<std::string, Value *> extra_fields){ + + cout << "end_link " + << time.to_string() + << " " + << *type + << " " + << *ancestor + << " " + << *destination + << " " + << *value + << " " + << key.to_string() + << " " + << to_string(extra_fields) + << endl; + free_str(); +} + + + + + +Container *Trace::search_container_type(String name) const{ + string *res = new string((string)"search(" + name.to_string() + ")"); + to_freed.push_back(res); + return res; +} + + +Container *Trace::search_container(String name) const{ + string* res = new string((string)"search(" + name.to_string() + ")"); + to_freed.push_back(res); + return res; +} + +Container *Trace::search_container(string name) const{ + string* res = new string((string)"search(" + name + ")"); + to_freed.push_back(res); + return res; +} + + +Container *Trace::search_event_type(String name){ + string* res = new string((string)"search(" + name.to_string() + ")"); + to_freed.push_back(res); + return res; +} + + + +Container *Trace::search_state_type(String name){ + string* res = new string("search(" + name.to_string() + ")"); + to_freed.push_back(res); + return res; +} + + + +VariableType *Trace::search_variable_type(String name){ + string* res = new string("search(" + name.to_string() + ")"); + to_freed.push_back(res); + return res; +} + + + +LinkType *Trace::search_link_type(String name){ + string* res = new string((string)"search(" + name.to_string() + ")"); + to_freed.push_back(res); + return res; +} + + + +EntityValue *Trace::search_entity_value(String name, EntityType *entity_type) const{ + string* res = new string((string)"search(" + name.to_string() + ")"); + to_freed.push_back(res); + return res; +} + +EntityType *Trace::search_entity_type(String name) const{ + string* res = new string((string)"search(" + name.to_string() + ")"); + to_freed.push_back(res); + return res; +} + +void Trace::finish(){ + cout << "finish" << endl; +} diff --git a/tests/stubs/Trace.hpp b/tests/stubs/Trace.hpp index bb6f8f6b698da2a1c6623ac72f88cdc17772a2c5..0e0998071c59148b7e854babacfcc0d94692f1ee 100644 --- a/tests/stubs/Trace.hpp +++ b/tests/stubs/Trace.hpp @@ -1,394 +1,394 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#ifndef TRACE_HPP -#define TRACE_HPP - - -#include <vector> -#include <map> -#include "Color.hpp" -#include "Date.hpp" -#include "Double.hpp" -#include "Hex.hpp" -#include "Integer.hpp" -#include "Name.hpp" -#include "String.hpp" -#include "Value.hpp" - -/*! - * - * \file Trace.hpp - * \author NOISETTE - * \brief Bouchon - * - * - * - */ - -typedef std::string Container ; -typedef std::string ContainerType ; -typedef std::string EntityType ; -typedef std::string StateType; -typedef std::string EntityValue; -typedef std::string EventType; -typedef std::string VariableType; -typedef std::string LinkType; - - -class Trace{ - -private: - mutable std::vector<std::string*> to_freed; - void free_str(); - -public : - - Trace(); - ~Trace(); - std::string to_string(std::map<std::string, Value *> extra_fields); - /*! - * - *\fn define_container_type() - *\brief This function is to define a container type - * - *\param String : the type of his parent container - *\param Name : an object that can contain a name, an alias or both - * - */ - void define_container_type(Name &alias, ContainerType *container_type_parent, std::map<std::string, Value *> extra_fields); - - /*! - * - *\fn create_container() - *\brief This function is to create a container - * - * - *\param Date : When the container is created - *\param Name : an object that can contain a name, an alias or both - *\param String : the type of the container - *\param String : the parent of the container - * - */ - void create_container(Date time, Name alias, ContainerType *type, Container *parent, std::map<std::string, Value *> extra_fields); - - /*! - * - *\fn destroy_container() - *\brief This function is to destroy a container - * - *\param Date : When the container is destroyed - *\param Name : an object that can contain a name, an alias or both - *\param Sring : the type of the container - * - */ - void destroy_container(Date time, Container *cont, ContainerType *type, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn define_event_type() - *\brief This function is to define a type of event - * - *\param Name : an object that can contain a name, an alias or both - *\param String : the type of the container - * - */ - void define_event_type(Name alias, ContainerType *container_type, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn define_state_type() - *\brief This function is to define a type of state - * - *\param Name : an object that can contain a name, an alias or both - *\param String : the type of the container - * - * - */ - void define_state_type(Name alias, ContainerType *container_type, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn define_variable_type() - *\brief This function is to define a type of variable - * - *\param Name : an object that can contain a name, an alias or both - *\param String : the type of the container - * - */ - void define_variable_type(Name alias, ContainerType *container_type, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn define_link_type() - *\brief This function is to define a type of link - * - *\param Name : an object that can contain a name, an alias or both - *\param String : the type of the container that is the common ancestor of both container - *\param String : the type of the container where the link starts - *\param String : the type of the container where the link goes - * - */ - void define_link_type(Name alias, ContainerType *ancestor, ContainerType *source, ContainerType *destination, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn define_entity_value() - *\brief This function is to define_entity_value - * - *\param Name : an object that can contain a name, an alias or both - *\param String : the type of the entity - * - */ - void define_entity_value(Name alias, EntityType *entity_type, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn set_state() - *\brief This function is to set a state - * - *\param Date : Moment when it changes of state - *\param String : the type of the entity - *\param String : the container - *\param String : the new value of the state - * - */ - void set_state(Date time, StateType *type, Container *container, EntityValue *value, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn push_state() - *\brief This function is to push a state on the stack - * - *\param Date : Moment when the state is pushed - *\param String : the type of the entity - *\param String : the container - *\param String : the new value of the state - * - */ - void push_state(Date time, StateType *type, Container *container, EntityValue *value, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn pop_state() - *\brief This function is to pop a state from the stack - * - *\param Date : Moment when the state is popped - *\param String : the type of the entity - *\param String : the container - * - */ - void pop_state(Date time, StateType *type, Container *container, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn new_event() - *\brief This function is to create a new event - * - *\param Date : When the new event arrives - *\param String : the type of the entity - *\param String : the container - *\param String : the value of the event - * - */ - void new_event(Date time, EventType *type, Container *container, EntityValue *value, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn set_variable() - *\brief This function is to set a value to the variable - * - *\param Date : When the variable is set - *\param String : the type of the entity - *\param String : the container - *\param double : the value of the variable - * - */ - void set_variable(Date time, VariableType *type, Container *container, Double value, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn add_variable() - *\brief This function is to add a new variable - * - *\param Date : When th variable is incremented - *\param String : the type of the entity - *\param String : the container - *\param double : the value of the variable - * - */ - void add_variable(Date time, VariableType *type, Container *container, Double value, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn sub_variable() - *\brief This function is to substract a value to the variable - * - *\param Date : When the variable is decremented - *\param String : the type of the entity - *\param String : the container - *\param double : the value of the variable - * - */ - void sub_variable(Date time, VariableType *type, Container *container, Double value, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn start_link() - *\brief This function is to start a link - * - *\param Date : When the link starts - *\param String : the type of the entity - *\param String : the container - *\param String : the source of the link - *\param String : the value of the variable - * - */ - void start_link(Date &time, LinkType *type, Container *ancestor, Container *source, EntityValue *value, String key, std::map<std::string, Value *> extra_fields); - - - /*! - * - *\fn end_link() - *\brief This function is to end a link - * - *\param Date : When the link ends - *\param String : the type of the entity - *\param String : the container - *\param String : the destination of the link - *\param String : the value of the variable - * - */ - void end_link(Date &time, LinkType *type, Container *ancestor, Container *destination, EntityValue *value, String key, std::map<std::string, Value *> extra_fields); - - - /*! - * - * \fn get_root_container - * \brief returns the list of the root container - * - */ - - - /*! - * - * \fn search_container_type - * \brief search a container type by his name or alias - * - */ - Container *search_container_type(String name) const; - - /*! - * - * \fn search_container - * \brief search a container by his name or alias - * - */ - Container *search_container(String name) const; - /*! - * - * \fn search_container - * \brief search a container by his name or alias - * - */ - Container *search_container(std::string name) const; - - /*! - * - * \fn search_event_type - * \brief search a event type by his name or alias - * - */ - Container *search_event_type(String name) ; - - - /*! - * - * \fn search_state_type - * \brief search a container by his name or alias - * - */ - Container *search_state_type(String name) ; - - - /*! - * - * \fn search_variable_type - * \brief search a variable type by his name or alias - * - */ - VariableType *search_variable_type(String name); - - - /*! - * - * \fn search_link_type - * \brief search a container by his name or alias - * - */ - LinkType *search_link_type(String name); /*! - * - * \fn search_entity_value - * \brief search a container by his name or alias - * - */ - EntityValue *search_entity_value(String name, EntityType *entity_type) const; - EntityType *search_entity_type(String name) const; - - void finish(); - -};//end class - -#endif + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#ifndef TRACE_HPP +#define TRACE_HPP + + +#include <vector> +#include <map> +#include "Color.hpp" +#include "Date.hpp" +#include "Double.hpp" +#include "Hex.hpp" +#include "Integer.hpp" +#include "Name.hpp" +#include "String.hpp" +#include "Value.hpp" + +/*! + * + * \file Trace.hpp + * \author NOISETTE + * \brief Bouchon + * + * + * + */ + +typedef std::string Container ; +typedef std::string ContainerType ; +typedef std::string EntityType ; +typedef std::string StateType; +typedef std::string EntityValue; +typedef std::string EventType; +typedef std::string VariableType; +typedef std::string LinkType; + + +class Trace{ + +private: + mutable std::vector<std::string*> to_freed; + void free_str(); + +public : + + Trace(); + ~Trace(); + std::string to_string(std::map<std::string, Value *> extra_fields); + /*! + * + *\fn define_container_type() + *\brief This function is to define a container type + * + *\param String : the type of his parent container + *\param Name : an object that can contain a name, an alias or both + * + */ + void define_container_type(Name &alias, ContainerType *container_type_parent, std::map<std::string, Value *> extra_fields); + + /*! + * + *\fn create_container() + *\brief This function is to create a container + * + * + *\param Date : When the container is created + *\param Name : an object that can contain a name, an alias or both + *\param String : the type of the container + *\param String : the parent of the container + * + */ + void create_container(Date time, Name alias, ContainerType *type, Container *parent, std::map<std::string, Value *> extra_fields); + + /*! + * + *\fn destroy_container() + *\brief This function is to destroy a container + * + *\param Date : When the container is destroyed + *\param Name : an object that can contain a name, an alias or both + *\param Sring : the type of the container + * + */ + void destroy_container(Date time, Container *cont, ContainerType *type, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn define_event_type() + *\brief This function is to define a type of event + * + *\param Name : an object that can contain a name, an alias or both + *\param String : the type of the container + * + */ + void define_event_type(Name alias, ContainerType *container_type, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn define_state_type() + *\brief This function is to define a type of state + * + *\param Name : an object that can contain a name, an alias or both + *\param String : the type of the container + * + * + */ + void define_state_type(Name alias, ContainerType *container_type, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn define_variable_type() + *\brief This function is to define a type of variable + * + *\param Name : an object that can contain a name, an alias or both + *\param String : the type of the container + * + */ + void define_variable_type(Name alias, ContainerType *container_type, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn define_link_type() + *\brief This function is to define a type of link + * + *\param Name : an object that can contain a name, an alias or both + *\param String : the type of the container that is the common ancestor of both container + *\param String : the type of the container where the link starts + *\param String : the type of the container where the link goes + * + */ + void define_link_type(Name alias, ContainerType *ancestor, ContainerType *source, ContainerType *destination, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn define_entity_value() + *\brief This function is to define_entity_value + * + *\param Name : an object that can contain a name, an alias or both + *\param String : the type of the entity + * + */ + void define_entity_value(Name alias, EntityType *entity_type, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn set_state() + *\brief This function is to set a state + * + *\param Date : Moment when it changes of state + *\param String : the type of the entity + *\param String : the container + *\param String : the new value of the state + * + */ + void set_state(Date time, StateType *type, Container *container, EntityValue *value, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn push_state() + *\brief This function is to push a state on the stack + * + *\param Date : Moment when the state is pushed + *\param String : the type of the entity + *\param String : the container + *\param String : the new value of the state + * + */ + void push_state(Date time, StateType *type, Container *container, EntityValue *value, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn pop_state() + *\brief This function is to pop a state from the stack + * + *\param Date : Moment when the state is popped + *\param String : the type of the entity + *\param String : the container + * + */ + void pop_state(Date time, StateType *type, Container *container, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn new_event() + *\brief This function is to create a new event + * + *\param Date : When the new event arrives + *\param String : the type of the entity + *\param String : the container + *\param String : the value of the event + * + */ + void new_event(Date time, EventType *type, Container *container, EntityValue *value, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn set_variable() + *\brief This function is to set a value to the variable + * + *\param Date : When the variable is set + *\param String : the type of the entity + *\param String : the container + *\param double : the value of the variable + * + */ + void set_variable(Date time, VariableType *type, Container *container, Double value, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn add_variable() + *\brief This function is to add a new variable + * + *\param Date : When th variable is incremented + *\param String : the type of the entity + *\param String : the container + *\param double : the value of the variable + * + */ + void add_variable(Date time, VariableType *type, Container *container, Double value, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn sub_variable() + *\brief This function is to substract a value to the variable + * + *\param Date : When the variable is decremented + *\param String : the type of the entity + *\param String : the container + *\param double : the value of the variable + * + */ + void sub_variable(Date time, VariableType *type, Container *container, Double value, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn start_link() + *\brief This function is to start a link + * + *\param Date : When the link starts + *\param String : the type of the entity + *\param String : the container + *\param String : the source of the link + *\param String : the value of the variable + * + */ + void start_link(Date &time, LinkType *type, Container *ancestor, Container *source, EntityValue *value, String key, std::map<std::string, Value *> extra_fields); + + + /*! + * + *\fn end_link() + *\brief This function is to end a link + * + *\param Date : When the link ends + *\param String : the type of the entity + *\param String : the container + *\param String : the destination of the link + *\param String : the value of the variable + * + */ + void end_link(Date &time, LinkType *type, Container *ancestor, Container *destination, EntityValue *value, String key, std::map<std::string, Value *> extra_fields); + + + /*! + * + * \fn get_root_container + * \brief returns the list of the root container + * + */ + + + /*! + * + * \fn search_container_type + * \brief search a container type by his name or alias + * + */ + Container *search_container_type(String name) const; + + /*! + * + * \fn search_container + * \brief search a container by his name or alias + * + */ + Container *search_container(String name) const; + /*! + * + * \fn search_container + * \brief search a container by his name or alias + * + */ + Container *search_container(std::string name) const; + + /*! + * + * \fn search_event_type + * \brief search a event type by his name or alias + * + */ + Container *search_event_type(String name) ; + + + /*! + * + * \fn search_state_type + * \brief search a container by his name or alias + * + */ + Container *search_state_type(String name) ; + + + /*! + * + * \fn search_variable_type + * \brief search a variable type by his name or alias + * + */ + VariableType *search_variable_type(String name); + + + /*! + * + * \fn search_link_type + * \brief search a container by his name or alias + * + */ + LinkType *search_link_type(String name); /*! + * + * \fn search_entity_value + * \brief search a container by his name or alias + * + */ + EntityValue *search_entity_value(String name, EntityType *entity_type) const; + EntityType *search_entity_type(String name) const; + + void finish(); + +};//end class + +#endif diff --git a/tests/stubs/Value.hpp b/tests/stubs/Value.hpp index d1a986285761d875e03a160413b4c7665ee0a3db..a6a93d080bb800003061a67f6f13c6b5a3d3c1ae 100644 --- a/tests/stubs/Value.hpp +++ b/tests/stubs/Value.hpp @@ -1,93 +1,93 @@ /* -** This file is part of the ViTE project. -** -** This software is governed by the CeCILL-A license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-A license and that you accept its terms. -** -** -** ViTE developpers are (for version 0.* to 1.0): -** -** - COULOMB Kevin -** - FAVERGE Mathieu -** - JAZEIX Johnny -** - LAGRASSE Olivier -** - MARCOUEILLE Jule -** - NOISETTE Pascal -** - REDONDY Arthur -** - VUCHENER Clément -** -*/ -#ifndef VALUE_HPP -#define VALUE_HPP - -/*! - * - * \file Value.hpp - * \author Clément Vuchener - * \brief Contains the definition of the class Value - * \date 2009 January 30th - * - */ - - -#include <string> - -// For std::setprecision -#include <iomanip> -#include<iostream> - -// For dots or commas separator in double numbers -#include <locale.h> - - -/*! - * - * \class Value - * \brief Abstract class to store calue used in the trace - * - */ -class Value { -public: - - virtual ~Value(){}; - - /*! - * - * \fn to_string() const = 0 - * \brief a to string method. - * \return the value in a string format. - * - */ - virtual std::string to_string() const = 0; - - /*! - * \brief The precision for printing double with std::cout or printf. - */ - static const int _PRECISION = 15; - -}; - -#endif // VALUE_HPP + ** This file is part of the ViTE project. + ** + ** This software is governed by the CeCILL-A license under French law + ** and abiding by the rules of distribution of free software. You can + ** use, modify and/or redistribute the software under the terms of the + ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following + ** URL: "http://www.cecill.info". + ** + ** As a counterpart to the access to the source code and rights to copy, + ** modify and redistribute granted by the license, users are provided + ** only with a limited warranty and the software's author, the holder of + ** the economic rights, and the successive licensors have only limited + ** liability. + ** + ** In this respect, the user's attention is drawn to the risks associated + ** with loading, using, modifying and/or developing or reproducing the + ** software by the user in light of its specific status of free software, + ** that may mean that it is complicated to manipulate, and that also + ** therefore means that it is reserved for developers and experienced + ** professionals having in-depth computer knowledge. Users are therefore + ** encouraged to load and test the software's suitability as regards + ** their requirements in conditions enabling the security of their + ** systems and/or data to be ensured and, more generally, to use and + ** operate it in the same conditions as regards security. + ** + ** The fact that you are presently reading this means that you have had + ** knowledge of the CeCILL-A license and that you accept its terms. + ** + ** + ** ViTE developpers are (for version 0.* to 1.0): + ** + ** - COULOMB Kevin + ** - FAVERGE Mathieu + ** - JAZEIX Johnny + ** - LAGRASSE Olivier + ** - MARCOUEILLE Jule + ** - NOISETTE Pascal + ** - REDONDY Arthur + ** - VUCHENER Clément + ** + */ +#ifndef VALUE_HPP +#define VALUE_HPP + +/*! + * + * \file Value.hpp + * \author Clément Vuchener + * \brief Contains the definition of the class Value + * \date 2009 January 30th + * + */ + + +#include <string> + +// For std::setprecision +#include <iomanip> +#include<iostream> + +// For dots or commas separator in double numbers +#include <locale.h> + + +/*! + * + * \class Value + * \brief Abstract class to store calue used in the trace + * + */ +class Value { +public: + + virtual ~Value(){}; + + /*! + * + * \fn to_string() const = 0 + * \brief a to string method. + * \return the value in a string format. + * + */ + virtual std::string to_string() const = 0; + + /*! + * \brief The precision for printing double with std::cout or printf. + */ + static const int _PRECISION = 15; + +}; + +#endif // VALUE_HPP