Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
41eff71f
Commit
41eff71f
authored
8 years ago
by
Van Herck, Walter
Browse files
Options
Downloads
Patches
Plain Diff
Small refactoring to addAxis
parent
c2d13c11
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Core/Instrument/OutputData.h
+15
-7
15 additions, 7 deletions
Core/Instrument/OutputData.h
with
15 additions
and
7 deletions
Core/Instrument/OutputData.h
+
15
−
7
View file @
41eff71f
...
@@ -253,6 +253,9 @@ private:
...
@@ -253,6 +253,9 @@ private:
//! returns serial number of axis with given name
//! returns serial number of axis with given name
size_t
getAxisIndex
(
const
std
::
string
&
axis_name
)
const
;
size_t
getAxisIndex
(
const
std
::
string
&
axis_name
)
const
;
//! checks if given axis name exists
bool
axisNameExists
(
const
std
::
string
&
axis_name
)
const
;
SafePointerVector
<
IAxis
>
m_value_axes
;
SafePointerVector
<
IAxis
>
m_value_axes
;
LLData
<
T
>*
mp_ll_data
;
LLData
<
T
>*
mp_ll_data
;
double
m_variability
;
double
m_variability
;
...
@@ -325,7 +328,7 @@ OutputData<double>* OutputData<T>::meanValues() const
...
@@ -325,7 +328,7 @@ OutputData<double>* OutputData<T>::meanValues() const
template
<
class
T
>
template
<
class
T
>
void
OutputData
<
T
>::
addAxis
(
const
IAxis
&
new_axis
)
void
OutputData
<
T
>::
addAxis
(
const
IAxis
&
new_axis
)
{
{
if
(
getAxi
s
(
new_axis
.
getName
())
)
if
(
axisNameExist
s
(
new_axis
.
getName
())
)
throw
Exceptions
::
LogicErrorException
(
throw
Exceptions
::
LogicErrorException
(
"OutputData<T>::addAxis(const IAxis& new_axis) -> "
"OutputData<T>::addAxis(const IAxis& new_axis) -> "
"Error! Attempt to add axis with already existing name '"
+
"Error! Attempt to add axis with already existing name '"
+
...
@@ -339,7 +342,7 @@ void OutputData<T>::addAxis(const IAxis& new_axis)
...
@@ -339,7 +342,7 @@ void OutputData<T>::addAxis(const IAxis& new_axis)
template
<
class
T
>
template
<
class
T
>
void
OutputData
<
T
>::
addAxis
(
const
std
::
string
&
name
,
size_t
size
,
double
start
,
double
end
)
void
OutputData
<
T
>::
addAxis
(
const
std
::
string
&
name
,
size_t
size
,
double
start
,
double
end
)
{
{
if
(
getAxi
s
(
name
)
)
if
(
axisNameExist
s
(
name
)
)
throw
Exceptions
::
LogicErrorException
(
throw
Exceptions
::
LogicErrorException
(
"OutputData<T>::addAxis(std::string name) -> "
"OutputData<T>::addAxis(std::string name) -> "
"Error! Attempt to add axis with already existing name '"
+
"Error! Attempt to add axis with already existing name '"
+
...
@@ -357,10 +360,7 @@ const IAxis* OutputData<T>::getAxis(size_t serial_number) const
...
@@ -357,10 +360,7 @@ const IAxis* OutputData<T>::getAxis(size_t serial_number) const
template
<
class
T
>
template
<
class
T
>
const
IAxis
*
OutputData
<
T
>::
getAxis
(
const
std
::
string
&
axis_name
)
const
const
IAxis
*
OutputData
<
T
>::
getAxis
(
const
std
::
string
&
axis_name
)
const
{
{
for
(
size_t
i
=
0
;
i
<
m_value_axes
.
size
();
++
i
)
return
getAxis
(
getAxisIndex
(
axis_name
));
if
(
m_value_axes
[
i
]
->
getName
()
==
axis_name
)
return
m_value_axes
[
i
];
return
0
;
}
}
template
<
class
T
>
template
<
class
T
>
...
@@ -677,9 +677,17 @@ size_t OutputData<T>::getAxisIndex(const std::string &axis_name) const
...
@@ -677,9 +677,17 @@ size_t OutputData<T>::getAxisIndex(const std::string &axis_name) const
for
(
size_t
i
=
0
;
i
<
m_value_axes
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
m_value_axes
.
size
();
++
i
)
if
(
m_value_axes
[
i
]
->
getName
()
==
axis_name
)
return
i
;
if
(
m_value_axes
[
i
]
->
getName
()
==
axis_name
)
return
i
;
throw
Exceptions
::
LogicErrorException
(
throw
Exceptions
::
LogicErrorException
(
"OutputData<T>::getAxis
SerialNumber
() -> "
"OutputData<T>::getAxis
Index
() -> "
"Error! Axis with given name not found '"
+
axis_name
+
std
::
string
(
"'"
));
"Error! Axis with given name not found '"
+
axis_name
+
std
::
string
(
"'"
));
}
}
template
<
class
T
>
bool
OutputData
<
T
>::
axisNameExists
(
const
std
::
string
&
axis_name
)
const
{
for
(
size_t
i
=
0
;
i
<
m_value_axes
.
size
();
++
i
)
if
(
m_value_axes
[
i
]
->
getName
()
==
axis_name
)
return
true
;
return
false
;
}
#endif // OUTPUTDATA_H
#endif // OUTPUTDATA_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment