Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
VACore
Commits
59956a58
Commit
59956a58
authored
Feb 03, 2017
by
Jonas Stienen
Browse files
Linux compatibility with in-consequent usage of string ref
parent
0b4379c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/VAHardwareSetup.cpp
View file @
59956a58
...
...
@@ -10,9 +10,9 @@
std
::
vector
<
const
CVAHardwareDevice
*
>
CVAHardwareSetup
::
GetDeviceListFromOutputGroup
(
const
std
::
string
&
sIdentifier
)
const
{
for
(
size_t
i
=
0
;
i
<
voOutputs
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
voOutputs
.
size
();
i
++
)
{
const
CVAHardwareOutput
&
oGroup
(
voOutputs
[
i
]
);
const
CVAHardwareOutput
&
oGroup
(
voOutputs
[
i
]
);
if
(
toUppercase
(
oGroup
.
sIdentifier
)
==
toUppercase
(
sIdentifier
)
)
return
oGroup
.
vpDevices
;
}
...
...
@@ -23,9 +23,9 @@ std::vector< const CVAHardwareDevice* > CVAHardwareSetup::GetDeviceListFromOutpu
std
::
vector
<
const
CVAHardwareDevice
*
>
CVAHardwareSetup
::
GetDeviceListFromInputGroup
(
const
std
::
string
&
sInputIdentifier
)
const
{
for
(
size_t
i
=
0
;
i
<
voInputs
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
voInputs
.
size
();
i
++
)
{
const
CVAHardwareInput
&
oGroup
(
voInputs
[
i
]
);
const
CVAHardwareInput
&
oGroup
(
voInputs
[
i
]
);
if
(
toUppercase
(
oGroup
.
sIdentifier
)
==
toUppercase
(
sInputIdentifier
)
)
return
oGroup
.
vpDevices
;
}
...
...
@@ -42,17 +42,17 @@ void CVAHardwareSetup::Init( const CVAStruct& oArgs )
CVAStruct
::
const_iterator
cit
=
oArgs
.
Begin
();
while
(
cit
!=
oArgs
.
End
()
)
{
const
std
::
string
&
sKey
(
cit
->
first
);
const
std
::
string
&
sKey
(
cit
->
first
);
std
::
vector
<
std
::
string
>
vsKeyParts
=
splitString
(
sKey
,
':'
);
if
(
vsKeyParts
.
size
()
==
2
&&
cit
->
second
.
GetDatatype
()
==
CVAStructValue
::
STRUCT
)
{
std
::
string
&
sCategory
(
toUppercase
(
vsKeyParts
[
0
]
));
// uppercase
std
::
string
sCategory
(
toUppercase
(
vsKeyParts
[
0
]
)
);
// uppercase
if
(
sCategory
==
"OUTPUTDEVICE"
)
{
CVAConfigInterpreter
devconf
(
cit
->
second
);
std
::
string
sIdentifier
=
vsKeyParts
[
1
];
std
::
string
sIdentifier
=
vsKeyParts
[
1
];
std
::
string
sDeviceType
;
devconf
.
OptString
(
"Type"
,
sDeviceType
,
"LS"
);
...
...
@@ -69,7 +69,7 @@ void CVAHardwareSetup::Init( const CVAStruct& oArgs )
std
::
string
sChannelList
;
devconf
.
ReqString
(
"Channels"
,
sChannelList
);
if
(
sChannelList
==
"true"
)
// hack, VAStruct returns the string 'true' if a number '1' is parsed instead of a string '1'
if
(
sChannelList
==
"true"
)
// hack, VAStruct returns the string 'true' if a number '1' is parsed instead of a string '1'
device
.
viChannels
.
push_back
(
1
);
else
device
.
viChannels
=
StringToIntVec
(
sChannelList
);
...
...
@@ -79,21 +79,21 @@ void CVAHardwareSetup::Init( const CVAStruct& oArgs )
std
::
vector
<
std
::
string
>
vsPosComponents
=
splitString
(
sPos
,
','
);
assert
(
vsPosComponents
.
size
()
==
3
);
device
.
vPos
.
x
=
StringToFloat
(
vsPosComponents
[
0
]
);
device
.
vPos
.
y
=
StringToFloat
(
vsPosComponents
[
1
]
);
device
.
vPos
.
z
=
StringToFloat
(
vsPosComponents
[
2
]
);
device
.
vPos
.
x
=
StringToFloat
(
vsPosComponents
[
0
]
);
device
.
vPos
.
y
=
StringToFloat
(
vsPosComponents
[
1
]
);
device
.
vPos
.
z
=
StringToFloat
(
vsPosComponents
[
2
]
);
std
::
string
sOrient
;
devconf
.
OptString
(
"OrientationYPR"
,
sOrient
,
"0,0,0"
);
std
::
vector
<
std
::
string
>
vsOrientComponents
=
splitString
(
sOrient
,
','
);
assert
(
vsOrientComponents
.
size
()
==
3
);
device
.
oOrientYPRDegree
.
yaw
=
StringToFloat
(
vsOrientComponents
[
0
]
);
device
.
oOrientYPRDegree
.
pitch
=
StringToFloat
(
vsOrientComponents
[
1
]
);
device
.
oOrientYPRDegree
.
roll
=
StringToFloat
(
vsOrientComponents
[
2
]
);
device
.
oOrientYPRDegree
.
yaw
=
StringToFloat
(
vsOrientComponents
[
0
]
);
device
.
oOrientYPRDegree
.
pitch
=
StringToFloat
(
vsOrientComponents
[
1
]
);
device
.
oOrientYPRDegree
.
roll
=
StringToFloat
(
vsOrientComponents
[
2
]
);
devconf
.
OptString
(
"DataFileName"
,
device
.
sDataFileName
);
voHardwareOutputDevices
.
push_back
(
device
);
}
else
if
(
sCategory
==
"INPUTDEVICE"
)
...
...
@@ -102,7 +102,7 @@ void CVAHardwareSetup::Init( const CVAStruct& oArgs )
CVAHardwareDevice
device
;
device
.
sIdentifier
=
vsKeyParts
[
1
];
device
.
sIdentifier
=
vsKeyParts
[
1
];
devconf
.
OptString
(
"Type"
,
device
.
sType
,
"MIC"
);
...
...
@@ -120,18 +120,18 @@ void CVAHardwareSetup::Init( const CVAStruct& oArgs )
std
::
vector
<
std
::
string
>
vsPosComponents
=
splitString
(
sPos
,
','
);
assert
(
vsPosComponents
.
size
()
==
3
);
device
.
vPos
.
x
=
StringToFloat
(
vsPosComponents
[
0
]
);
device
.
vPos
.
y
=
StringToFloat
(
vsPosComponents
[
1
]
);
device
.
vPos
.
z
=
StringToFloat
(
vsPosComponents
[
2
]
);
device
.
vPos
.
x
=
StringToFloat
(
vsPosComponents
[
0
]
);
device
.
vPos
.
y
=
StringToFloat
(
vsPosComponents
[
1
]
);
device
.
vPos
.
z
=
StringToFloat
(
vsPosComponents
[
2
]
);
std
::
string
sOrient
;
devconf
.
OptString
(
"OrientationYPR"
,
sOrient
,
"0,0,0"
);
std
::
vector
<
std
::
string
>
vsOrientComponents
=
splitString
(
sOrient
,
','
);
assert
(
vsOrientComponents
.
size
()
==
3
);
device
.
oOrientYPRDegree
.
yaw
=
StringToFloat
(
vsOrientComponents
[
0
]
);
device
.
oOrientYPRDegree
.
pitch
=
StringToFloat
(
vsOrientComponents
[
1
]
);
device
.
oOrientYPRDegree
.
roll
=
StringToFloat
(
vsOrientComponents
[
2
]
);
device
.
oOrientYPRDegree
.
yaw
=
StringToFloat
(
vsOrientComponents
[
0
]
);
device
.
oOrientYPRDegree
.
pitch
=
StringToFloat
(
vsOrientComponents
[
1
]
);
device
.
oOrientYPRDegree
.
roll
=
StringToFloat
(
vsOrientComponents
[
2
]
);
voHardwareInputDevices
.
push_back
(
device
);
}
...
...
@@ -153,12 +153,12 @@ void CVAHardwareSetup::Init( const CVAStruct& oArgs )
std
::
vector
<
std
::
string
>
vsKeyParts
=
splitString
(
sKey
,
":"
);
if
(
vsKeyParts
.
size
()
==
2
&&
cit
->
second
.
GetDatatype
()
==
CVAStructValue
::
STRUCT
)
{
std
::
string
&
sCategory
(
toUppercase
(
vsKeyParts
[
0
]
));
// uppercase
std
::
string
sCategory
(
toUppercase
(
vsKeyParts
[
0
]
)
);
// uppercase
if
(
sCategory
==
"OUTPUT"
)
{
CVAConfigInterpreter
outconf
(
cit
->
second
);
CVAHardwareOutput
oOutput
;
oOutput
.
sIdentifier
=
vsKeyParts
[
1
];
oOutput
.
sIdentifier
=
vsKeyParts
[
1
];
outconf
.
OptString
(
"Description"
,
oOutput
.
sDesc
);
outconf
.
OptBool
(
"Enabled"
,
oOutput
.
bEnabled
,
true
);
...
...
@@ -166,10 +166,10 @@ void CVAHardwareSetup::Init( const CVAStruct& oArgs )
std
::
string
sDevices
;
outconf
.
ReqString
(
"Devices"
,
sDevices
);
std
::
vector
<
std
::
string
>
vsDeviceIdentifier
=
StringToStringVec
(
sDevices
);
for
(
size_t
i
=
0
;
i
<
vsDeviceIdentifier
.
size
();
i
++
)
for
(
size_t
j
=
0
;
j
<
voHardwareOutputDevices
.
size
();
j
++
)
if
(
vsDeviceIdentifier
[
i
]
==
voHardwareOutputDevices
[
j
].
sIdentifier
)
oOutput
.
vpDevices
.
push_back
(
&
voHardwareOutputDevices
[
j
]
);
for
(
size_t
i
=
0
;
i
<
vsDeviceIdentifier
.
size
();
i
++
)
for
(
size_t
j
=
0
;
j
<
voHardwareOutputDevices
.
size
();
j
++
)
if
(
vsDeviceIdentifier
[
i
]
==
voHardwareOutputDevices
[
j
].
sIdentifier
)
oOutput
.
vpDevices
.
push_back
(
&
voHardwareOutputDevices
[
j
]
);
voOutputs
.
push_back
(
oOutput
);
...
...
@@ -178,7 +178,7 @@ void CVAHardwareSetup::Init( const CVAStruct& oArgs )
{
CVAConfigInterpreter
inconf
(
cit
->
second
);
CVAHardwareInput
oInput
;
oInput
.
sIdentifier
=
vsKeyParts
[
1
];
oInput
.
sIdentifier
=
vsKeyParts
[
1
];
inconf
.
OptString
(
"Description"
,
oInput
.
sDesc
);
inconf
.
OptBool
(
"Active"
,
oInput
.
bActive
,
true
);
...
...
@@ -186,10 +186,10 @@ void CVAHardwareSetup::Init( const CVAStruct& oArgs )
std
::
string
sDevices
;
inconf
.
ReqString
(
"Devices"
,
sDevices
);
std
::
vector
<
std
::
string
>
vsDeviceIdentifier
=
StringToStringVec
(
sDevices
);
for
(
size_t
i
=
0
;
i
<
vsDeviceIdentifier
.
size
();
i
++
)
for
(
size_t
j
=
0
;
j
<
voHardwareInputDevices
.
size
();
j
++
)
if
(
vsDeviceIdentifier
[
i
]
==
voHardwareInputDevices
[
j
].
sIdentifier
)
oInput
.
vpDevices
.
push_back
(
&
voHardwareInputDevices
[
j
]
);
for
(
size_t
i
=
0
;
i
<
vsDeviceIdentifier
.
size
();
i
++
)
for
(
size_t
j
=
0
;
j
<
voHardwareInputDevices
.
size
();
j
++
)
if
(
vsDeviceIdentifier
[
i
]
==
voHardwareInputDevices
[
j
].
sIdentifier
)
oInput
.
vpDevices
.
push_back
(
&
voHardwareInputDevices
[
j
]
);
voInputs
.
push_back
(
oInput
);
...
...
@@ -208,9 +208,9 @@ void CVAHardwareSetup::Init( const CVAStruct& oArgs )
const
CVAHardwareInput
*
CVAHardwareSetup
::
GetInput
(
const
std
::
string
&
sInput
)
const
{
for
(
size_t
i
=
0
;
i
<
voInputs
.
size
();
i
++
)
if
(
toUppercase
(
sInput
)
==
toUppercase
(
voInputs
[
i
].
sIdentifier
)
)
return
&
voInputs
[
i
];
for
(
size_t
i
=
0
;
i
<
voInputs
.
size
();
i
++
)
if
(
toUppercase
(
sInput
)
==
toUppercase
(
voInputs
[
i
].
sIdentifier
)
)
return
&
voInputs
[
i
];
return
nullptr
;
}
...
...
@@ -218,11 +218,11 @@ std::vector< int > CVAHardwareInput::GetPhysicalInputChannels() const
{
std
::
vector
<
int
>
viChannels
;
for
(
size_t
i
=
0
;
i
<
vpDevices
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
vpDevices
.
size
();
i
++
)
{
const
CVAHardwareDevice
*
pDevice
(
vpDevices
[
i
]
);
for
(
size_t
j
=
0
;
j
<
pDevice
->
viChannels
.
size
();
j
++
)
viChannels
.
push_back
(
pDevice
->
viChannels
[
j
]
);
const
CVAHardwareDevice
*
pDevice
(
vpDevices
[
i
]
);
for
(
size_t
j
=
0
;
j
<
pDevice
->
viChannels
.
size
();
j
++
)
viChannels
.
push_back
(
pDevice
->
viChannels
[
j
]
);
}
return
viChannels
;
...
...
@@ -235,9 +235,9 @@ bool CVAHardwareOutput::IsEnabled() const
const
CVAHardwareOutput
*
CVAHardwareSetup
::
GetOutput
(
const
std
::
string
&
sOutput
)
const
{
for
(
size_t
i
=
0
;
i
<
voOutputs
.
size
();
i
++
)
if
(
toUppercase
(
sOutput
)
==
toUppercase
(
voOutputs
[
i
].
sIdentifier
)
)
return
&
voOutputs
[
i
];
for
(
size_t
i
=
0
;
i
<
voOutputs
.
size
();
i
++
)
if
(
toUppercase
(
sOutput
)
==
toUppercase
(
voOutputs
[
i
].
sIdentifier
)
)
return
&
voOutputs
[
i
];
return
nullptr
;
}
...
...
@@ -245,11 +245,11 @@ std::vector< int > CVAHardwareOutput::GetPhysicalOutputChannels() const
{
std
::
vector
<
int
>
viChannels
;
for
(
size_t
i
=
0
;
i
<
vpDevices
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
vpDevices
.
size
();
i
++
)
{
const
CVAHardwareDevice
*
pDevice
(
vpDevices
[
i
]
);
for
(
size_t
j
=
0
;
j
<
pDevice
->
viChannels
.
size
();
j
++
)
viChannels
.
push_back
(
pDevice
->
viChannels
[
j
]
);
const
CVAHardwareDevice
*
pDevice
(
vpDevices
[
i
]
);
for
(
size_t
j
=
0
;
j
<
pDevice
->
viChannels
.
size
();
j
++
)
viChannels
.
push_back
(
pDevice
->
viChannels
[
j
]
);
}
return
viChannels
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment