Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Institute of Technical Acoustics (ITA)
ITABase
Commits
c684d74b
Commit
c684d74b
authored
Nov 22, 2016
by
Fabian Schlieper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
odroid changes
parent
fc7518ee
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
829 additions
and
819 deletions
+829
-819
CMakeLists.txt
CMakeLists.txt
+10
-7
include/ITAConfigUtils.h
include/ITAConfigUtils.h
+7
-5
include/ITADataLog.h
include/ITADataLog.h
+1
-2
include/ITAHPT.h
include/ITAHPT.h
+6
-0
include/ITAStringUtils.h
include/ITAStringUtils.h
+1
-1
src/ITAASCIITable.cpp
src/ITAASCIITable.cpp
+1
-1
src/ITAAtomicOpsGCCBuiltinsImpl.cpp
src/ITAAtomicOpsGCCBuiltinsImpl.cpp
+103
-105
src/ITAAudiofileCommon.cpp
src/ITAAudiofileCommon.cpp
+37
-37
src/ITAConfigUtils.cpp
src/ITAConfigUtils.cpp
+658
-658
src/ITAConfigUtilsSimpleIniImpl.cpp
src/ITAConfigUtilsSimpleIniImpl.cpp
+2
-2
src/ITACriticalSectionPosixImpl.h
src/ITACriticalSectionPosixImpl.h
+2
-0
src/ITADebug.cpp
src/ITADebug.cpp
+1
-1
No files found.
CMakeLists.txt
View file @
c684d74b
...
...
@@ -116,6 +116,10 @@ set( ITABaseSources
if
(
WIN32
)
list
(
APPEND ITABaseHeader
"include/ITAHPT.h"
"include/ITAMutex.h"
"include/ITATimer.h"
)
list
(
APPEND ITABaseSources
"src/ITAHPT.cpp"
"src/ITAMutex.cpp"
"src/ITATimer.cpp"
)
else
(
WIN32
)
add_definitions
(
-DUSE_SIMPLEINI
)
list
(
APPEND ITABaseSources
"src/ITAPosixRealtimeClock.cpp"
"src/simpleini/SimpleIni.h"
"src/simpleini/ConvertUTF.h"
"src/simpleini/ConvertUTF.c"
)
list
(
APPEND ITABaseSources
"src/ITAConfigUtilsSimpleIniImpl.cpp"
)
endif
(
WIN32
)
...
...
@@ -162,15 +166,10 @@ if( VPCRE_FOUND AND ITA_BASE_WITH_REGULAR_EXPRESSIONS )
list
(
APPEND ITABaseSources
"src/ITAConfigUtils.cpp"
"src/ITAStringUtilsPCRE.cpp"
)
add_definitions
(
-DPCRE_STATIC
)
else
(
VPCRE_FOUND AND ITA_BASE_WITH_REGULAR_EXPRESSIONS
)
list
(
APPEND ITABaseSources
"src/ITAStringUtils.cpp"
)
list
(
APPEND ITABaseSources
"src/ITAConfigUtils.cpp"
"src/ITAStringUtils.cpp"
)
endif
(
VPCRE_FOUND AND ITA_BASE_WITH_REGULAR_EXPRESSIONS
)
if
(
VSIMPLEINI_FOUND AND ITA_BASE_WITH_CONFIG_SIMPLE_INI
)
if
(
NOT ITA_BASE_WITH_REGULAR_EXPRESSIONS
)
message
(
FATAL_ERROR
"ITABase old config implementation requires regular expressions. Please activate."
)
endif
(
NOT ITA_BASE_WITH_REGULAR_EXPRESSIONS
)
list
(
APPEND ITABaseSources
"src/ITAConfigUtilsSimpleIniImpl.cpp"
)
endif
(
VSIMPLEINI_FOUND AND ITA_BASE_WITH_CONFIG_SIMPLE_INI
)
if
(
ITA_BASE_WITH_CONFIG_OLD_IMPL AND NOT ITA_BASE_WITH_CONFIG_SIMPLE_INI
)
if
(
NOT ITA_BASE_WITH_REGULAR_EXPRESSIONS
)
...
...
@@ -197,6 +196,10 @@ else( NOT ITA_CORE_LIBS_BUILD_STATIC )
endif
(
NOT ITA_CORE_LIBS_BUILD_STATIC
)
if
(
NOT WIN32
)
add_definitions
(
-std=gnu++11
)
endif
()
# linker
add_library
(
ITABase
${
ITABaseHeader
}
${
ITABaseSources
}
)
target_link_libraries
(
ITABase
${
VISTA_USE_PACKAGE_LIBRARIES
}
)
...
...
include/ITAConfigUtils.h
View file @
c684d74b
...
...
@@ -201,6 +201,12 @@ ITA_BASE_API std::string INIFileReadString(const std::string& sINIFilename,
const
std
::
string
&
sKey
,
std
::
string
sDefaultValue
=
""
);
//! Mit Kommas getrennte Liste von Strings aus INI-Datei lesen
ITA_BASE_API
std
::
vector
<
std
::
string
>
INIFileReadStringList
(
const
std
::
string
&
sINIFilename
,
const
std
::
string
&
sSection
,
const
std
::
string
&
sKey
,
char
cSeparator
=
','
);
//! Mit Kommas getrennte Liste von int-Werten aus INI-Datei lesen und in template Enum-Typ konvertieren
template
<
typename
TEnum
>
std
::
vector
<
TEnum
>
INIFileReadEnumList
(
const
std
::
string
&
sINIFilename
,
...
...
@@ -241,11 +247,7 @@ ITA_BASE_API std::vector<double> INIFileReadDoubleList(const std::string& sINIFi
const
std
::
string
&
sKey
,
char
cSeparator
=
','
);
//! Mit Kommas getrennte Liste von Strings aus INI-Datei lesen
ITA_BASE_API
std
::
vector
<
std
::
string
>
INIFileReadStringList
(
const
std
::
string
&
sINIFilename
,
const
std
::
string
&
sSection
,
const
std
::
string
&
sKey
,
char
cSeparator
=
','
);
/* +-----------------------------------------------------------------------------------------+
* | |
...
...
include/ITADataLog.h
View file @
c684d74b
...
...
@@ -134,8 +134,7 @@ template <class T> void ITABufferedDataLogger<T>::log(const T& oLogItem) {
m_vLogItems
.
push_back
(
oLogItem
);
}
template
<
class
T
>
void
ITABufferedDataLogger
<
T
>::
store
(
std
::
string
sFilename
)
{
template
<
class
T
>
void
ITABufferedDataLogger
<
T
>::
store
(
const
std
::
string
&
sFilename
)
{
std
::
ofstream
os
(
sFilename
.
c_str
(),
std
::
ios
::
out
|
std
::
ios
::
trunc
|
std
::
ios
::
binary
);
if
(
!
os
.
is_open
())
ITA_EXCEPT1
(
IO_ERROR
,
std
::
string
(
"Could not create log output file
\"
"
)
+
sFilename
+
std
::
string
(
"
\"
"
));
...
...
include/ITAHPT.h
View file @
c684d74b
...
...
@@ -27,7 +27,13 @@
#endif
#include <string>
#ifdef WIN32
#include <windows.h>
#else
#include <stdio.h>
#include <linux/types.h>
#define __int64 int64_t
#endif
// Definition des Datentyps für Timerticks
typedef
__int64
ITATimerTicks
;
...
...
include/ITAStringUtils.h
View file @
c684d74b
...
...
@@ -26,7 +26,7 @@
#include <string>
#include <vector>
#include <sstream>
// Konvertierungsklasse
class
ITA_BASE_API
ITAConversion
...
...
src/ITAASCIITable.cpp
View file @
c684d74b
...
...
@@ -5,7 +5,7 @@
#include <iomanip>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <ITAStringUtils.h>
...
...
src/ITAAtomicOpsGCCBuiltinsImpl.cpp
View file @
c684d74b
/*
+-----------------------------------------------------------------------+
| |
| ITAToolkit |
| |
| (c) Copyright Institut für technische Akustik (ITA) |
| Aachen university of technology (RWTH), 2005-2008 |
| |
+-----------------------------------------------------------------------+
| |
| File: ITAAtomicOps.cpp |
| Purpose: Atomare Grundfunktionen für non-blocking concurrency |
| Authors: Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de |
| |
+-----------------------------------------------------------------------+
*/
// $Id: ITAAtomicOpsGCCBuiltinsImpl.cpp 3454 2013-08-21 14:40:16Z stienen $
#include "ITAAtomicOps.h"
#include <stdint.h>
typedef
union
{
int32_t
i32Value
;
float
floatValue
;
}
ConvI32Float
;
int
atomic_read_int
(
volatile
const
int
*
src
)
{
/*
* Trick: Realisierung mittels CAS!
* Falls der Wert schon 0, dann wird er gegen 0 ausgetauscht...
* Also keine Änderung!
*/
return
__sync_val_compare_and_swap
(
(
int
*
)
src
,
0
,
0
);
}
float
atomic_read_float
(
volatile
const
float
*
src
)
{
/*
* Trick: Realisierung mittels CAS!
* Falls der Wert schon 0, dann wird er gegen 0 ausgetauscht...
* Also keine �nderung!
*
* Info: Auf manchen Architekturen ist InterlockedAdd(src, 0) schneller.
* Leider steht InterlockedAdd nur auf Itanium-Arch. zur Verf�gung.
*/
ConvI32Float
c
;
c
.
i32Value
=
__sync_val_compare_and_swap
((
volatile
int32_t
*
)
src
,
0
,
0
);
return
c
.
floatValue
;
}
void
*
atomic_read_ptr
(
volatile
const
void
**
src
)
{
/*
* Trick: Realisierung mittels CAS!
* Falls der Wert schon 0, dann wird er gegen 0 ausgetauscht...
* Also keine Änderung!
*/
return
__sync_val_compare_and_swap
((
void
**
)
src
,
0
,
0
);
}
void
atomic_write_int
(
volatile
int
*
dest
,
int
value
)
{
__sync_lock_test_and_set
(
dest
,
value
);
}
void
atomic_write_float
(
volatile
float
*
dest
,
float
value
)
{
ConvI32Float
c
;
c
.
floatValue
=
value
;
__sync_lock_test_and_set
((
volatile
int32_t
*
)
dest
,
c
.
i32Value
);
}
void
atomic_write_ptr
(
volatile
void
**
dest
,
void
*
value
)
{
__sync_lock_test_and_set
(
dest
,
value
);
}
bool
atomic_cas_int
(
volatile
int
*
dest
,
int
expected_value
,
int
new_value
)
{
return
__sync_bool_compare_and_swap
(
dest
,
expected_value
,
new_value
);
}
/*
bool atomic_cas_double(volatile double* dest, double expected_value, double new_value) {
return __sync_bool_compare_and_swap(dest, expected_value, new_value);
}
*/
bool
atomic_cas_ptr
(
volatile
void
**
dest
,
void
*
expected_value
,
void
*
new_value
)
{
return
__sync_bool_compare_and_swap
(
dest
,
expected_value
,
new_value
);
}
void
atomic_read32
(
volatile
void
*
src
,
void
*
dest
)
{
*
((
int32_t
*
)
dest
)
=
__sync_val_compare_and_swap
((
volatile
int32_t
*
)
src
,
0
,
0
);
}
bool
atomic_cas32
(
volatile
void
*
dest
,
void
*
expected_value
,
void
*
new_value
)
{
return
__sync_bool_compare_and_swap
(
&
dest
,
expected_value
,
new_value
);
//return __sync_bool_compare_and_swap( (volatile int32_t*)dest, (int32_t*)expected_value, (int32_t*)new_value );
}
int
atomic_inc_int
(
volatile
int
*
dest
)
{
return
__sync_fetch_and_add
(
dest
,
1
);
}
int
atomic_dec_int
(
volatile
int
*
dest
)
{
return
__sync_fetch_and_sub
(
dest
,
1
);
}
/*
+-----------------------------------------------------------------------+
| |
| ITAToolkit |
| |
| (c) Copyright Institut für technische Akustik (ITA) |
| Aachen university of technology (RWTH), 2005-2008 |
| |
+-----------------------------------------------------------------------+
| |
| File: ITAAtomicOps.cpp |
| Purpose: Atomare Grundfunktionen für non-blocking concurrency |
| Authors: Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de |
| |
+-----------------------------------------------------------------------+
*/
// $Id: ITAAtomicOpsGCCBuiltinsImpl.cpp 3454 2013-08-21 14:40:16Z stienen $
#include "ITAAtomicOps.h"
#include <stdint.h>
typedef
union
{
int32_t
i32Value
;
float
floatValue
;
}
ConvI32Float
;
int
atomic_read_int
(
volatile
const
int
*
src
)
{
/*
* Trick: Realisierung mittels CAS!
* Falls der Wert schon 0, dann wird er gegen 0 ausgetauscht...
* Also keine Änderung!
*/
return
__sync_val_compare_and_swap
(
(
int
*
)
src
,
0
,
0
);
}
float
atomic_read_float
(
volatile
const
float
*
src
)
{
/*
* Trick: Realisierung mittels CAS!
* Falls der Wert schon 0, dann wird er gegen 0 ausgetauscht...
* Also keine �nderung!
*
* Info: Auf manchen Architekturen ist InterlockedAdd(src, 0) schneller.
* Leider steht InterlockedAdd nur auf Itanium-Arch. zur Verf�gung.
*/
ConvI32Float
c
;
c
.
i32Value
=
__sync_val_compare_and_swap
((
volatile
int32_t
*
)
src
,
0
,
0
);
return
c
.
floatValue
;
}
void
*
atomic_read_ptr
(
volatile
const
void
**
src
)
{
/*
* Trick: Realisierung mittels CAS!
* Falls der Wert schon 0, dann wird er gegen 0 ausgetauscht...
* Also keine Änderung!
*/
return
__sync_val_compare_and_swap
((
void
**
)
src
,
0
,
0
);
}
void
atomic_write_int
(
volatile
int
*
dest
,
int
value
)
{
__sync_lock_test_and_set
(
dest
,
value
);
}
void
atomic_write_float
(
volatile
float
*
dest
,
float
value
)
{
ConvI32Float
c
;
c
.
floatValue
=
value
;
__sync_lock_test_and_set
((
volatile
int32_t
*
)
dest
,
c
.
i32Value
);
}
void
atomic_write_ptr
(
volatile
void
**
dest
,
void
*
value
)
{
__sync_lock_test_and_set
(
dest
,
value
);
}
bool
atomic_cas_int
(
volatile
int
*
dest
,
int
expected_value
,
int
new_value
)
{
return
__sync_bool_compare_and_swap
(
dest
,
expected_value
,
new_value
);
}
/*
bool atomic_cas_double(volatile double* dest, double expected_value, double new_value) {
return __sync_bool_compare_and_swap(dest, expected_value, new_value);
}
*/
bool
atomic_cas_ptr
(
volatile
void
**
dest
,
void
*
expected_value
,
void
*
new_value
)
{
return
__sync_bool_compare_and_swap
(
dest
,
expected_value
,
new_value
);
}
void
atomic_read32
(
volatile
void
*
src
,
void
*
dest
)
{
*
((
int32_t
*
)
dest
)
=
__sync_val_compare_and_swap
((
volatile
int32_t
*
)
src
,
0
,
0
);
}
bool
atomic_cas32
(
volatile
void
*
dest
,
void
*
expected_value
,
void
*
new_value
)
{
return
__sync_bool_compare_and_swap
((
volatile
int32_t
*
)
dest
,
*
(
int32_t
*
)
expected_value
,
*
(
int32_t
*
)
new_value
);
}
int
atomic_inc_int
(
volatile
int
*
dest
)
{
return
__sync_fetch_and_add
(
dest
,
1
);
}
int
atomic_dec_int
(
volatile
int
*
dest
)
{
return
__sync_fetch_and_sub
(
dest
,
1
);
}
src/ITAAudiofileCommon.cpp
View file @
c684d74b
#include "ITAAudiofileCommon.h"
#include <cstdio>
std
::
string
toString
(
ITAQuantization
eQuantization
)
{
switch
(
eQuantization
)
{
case
ITAQuantization
::
ITA_INT16
:
return
"Integer with 16-Bit"
;
case
ITAQuantization
::
ITA_INT20
:
return
"Integer with 20-Bit"
;
case
ITAQuantization
::
ITA_INT24
:
return
"Integer with 24-Bit"
;
case
ITAQuantization
::
ITA_INT32
:
return
"Integer with 32-Bit"
;
case
ITAQuantization
::
ITA_FLOAT
:
return
"Floating point with 32-Bit"
;
case
ITAQuantization
::
ITA_DOUBLE
:
return
"Floating point with 64-Bit"
;
default:
return
"Unkown"
;
}
}
std
::
string
toString
(
ITADomain
eDomain
)
{
return
(
eDomain
==
ITADomain
::
ITA_TIME_DOMAIN
?
"
Zeitbereich
"
:
"
F
requen
zbereich
"
);
}
void
print
(
const
ITAAudiofileProperties
&
props
)
{
printf
(
"%s | %0.1f Hz | %i channels | %s | length: %i Samples"
,
toString
(
props
.
eDomain
).
c_str
(),
props
.
dSampleRate
,
props
.
iChannels
,
toString
(
props
.
eQuantization
).
c_str
(),
props
.
iLength
);
if
(
!
props
.
sComment
.
empty
()
)
printf
(
" | Comment:
\"
%s
\"
"
,
props
.
sComment
.
c_str
()
);
printf
(
"
\n
"
);
}
#include "ITAAudiofileCommon.h"
#include <cstdio>
std
::
string
toString
(
ITAQuantization
eQuantization
)
{
switch
(
eQuantization
)
{
case
ITAQuantization
::
ITA_INT16
:
return
"Integer with 16-Bit"
;
case
ITAQuantization
::
ITA_INT20
:
return
"Integer with 20-Bit"
;
case
ITAQuantization
::
ITA_INT24
:
return
"Integer with 24-Bit"
;
case
ITAQuantization
::
ITA_INT32
:
return
"Integer with 32-Bit"
;
case
ITAQuantization
::
ITA_FLOAT
:
return
"Floating point with 32-Bit"
;
case
ITAQuantization
::
ITA_DOUBLE
:
return
"Floating point with 64-Bit"
;
default:
return
"Unkown"
;
}
}
std
::
string
toString
(
ITADomain
eDomain
)
{
return
(
eDomain
==
ITADomain
::
ITA_TIME_DOMAIN
?
"
time domain
"
:
"
f
requen
cy domain
"
);
}
void
print
(
const
ITAAudiofileProperties
&
props
)
{
printf
(
"%s | %0.1f Hz | %i channels | %s | length: %i Samples"
,
toString
(
props
.
eDomain
).
c_str
(),
props
.
dSampleRate
,
props
.
iChannels
,
toString
(
props
.
eQuantization
).
c_str
(),
props
.
iLength
);
if
(
!
props
.
sComment
.
empty
()
)
printf
(
" | Comment:
\"
%s
\"
"
,
props
.
sComment
.
c_str
()
);
printf
(
"
\n
"
);
}
src/ITAConfigUtils.cpp
View file @
c684d74b
This diff is collapsed.
Click to expand it.
src/ITAConfigUtilsSimpleIniImpl.cpp
View file @
c684d74b
...
...
@@ -21,9 +21,9 @@
#ifdef USE_SIMPLEINI
#include <ITAException.h>
#include <ITAFile
s
ystemUtils.h>
#include <ITAFile
S
ystemUtils.h>
#include "
../3rdParty/S
imple
I
ni/SimpleIni.h"
#include "
s
imple
i
ni/SimpleIni.h"
//
//// Bugfix (fwe): Falls kein Pfad und nur ein Dateinamen angebenen ist, muss .\ vorne angeh�ngt werden
...
...
src/ITACriticalSectionPosixImpl.h
View file @
c684d74b
...
...
@@ -18,8 +18,10 @@
class
ITACriticalSectionPosixImpl
:
public
ITACriticalSectionImpl
{
public:
ITACriticalSectionPosixImpl
()
:
mutex
(
PTHREAD_MUTEX_INITIALIZER
)
{
pthread_mutexattr_init
(
&
mutexattr
);
pthread_mutexattr_settype
(
&
mutexattr
,
PTHREAD_MUTEX_RECURSIVE_NP
);
pthread_mutex_init
(
&
mutex
,
&
mutexattr
);
pthread_mutexattr_destroy
(
&
mutexattr
);
}
~
ITACriticalSectionPosixImpl
()
{
...
...
src/ITADebug.cpp
View file @
c684d74b
...
...
@@ -93,7 +93,7 @@ void SetThreadName(long lThreadID, const char* szThreadName) {
void
DEBUG_PRINTF
(
const
char
*
format
,
...
)
{
va_list
args
;
va_start
(
args
,
format
);
printf
(
format
,
args
);
v
printf
(
format
,
args
);
va_end
(
args
);
}
#endif // Linux
\ No newline at end of file
Write
Preview
Markdown
is supported
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