Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
a88afa45
Commit
a88afa45
authored
May 04, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Небольшая оптимизация insert ==> emplace
parent
b438c2e7
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
18 additions
and
17 deletions
+18
-17
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+2
-2
RRDServer.cc
extensions/RRDServer/RRDServer.cc
+1
-1
UniSetTypes.h
include/UniSetTypes.h
+2
-1
UInterface.cc
src/Interfaces/UInterface.cc
+1
-1
ObjectIndex_idXML.cc
src/ObjectRepository/ObjectIndex_idXML.cc
+4
-4
ProxyManager.cc
src/ObjectRepository/ProxyManager.cc
+1
-1
UniSetTypes.cc
src/ObjectRepository/UniSetTypes.cc
+4
-4
IOController.cc
src/Processes/IOController.cc
+1
-1
IONotifyController.cc
src/Processes/IONotifyController.cc
+2
-2
No files found.
extensions/ModbusMaster/MBExchange.cc
View file @
a88afa45
...
...
@@ -1995,7 +1995,7 @@ MBExchange::RTUDevice* MBExchange::addDev( RTUDeviceMap& mp, ModbusRTU::ModbusAd
return
0
;
}
mp
.
insert
(
RTUDeviceMap
::
value_type
(
a
,
d
)
);
mp
.
insert
(
std
::
make_pair
(
a
,
d
)
);
return
d
;
}
// ------------------------------------------------------------------------------------------
...
...
@@ -2040,7 +2040,7 @@ MBExchange::RegInfo* MBExchange::addReg( RegMap& mp, RegID id, ModbusRTU::Modbus
ri
->
mbreg
=
r
;
ri
->
id
=
id
;
mp
.
insert
(
RegMap
::
value_type
(
id
,
ri
));
mp
.
insert
(
std
::
make_pair
(
id
,
ri
));
ri
->
rit
=
mp
.
find
(
id
);
return
ri
;
...
...
extensions/RRDServer/RRDServer.cc
View file @
a88afa45
...
...
@@ -161,7 +161,7 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
}
DSInfo
ds
(
dsname
,
it1
.
getIntProp
(
"default"
));
dsmap
.
insert
(
DSMap
::
value_type
(
sid
,
ds
)
);
dsmap
.
emplace
(
sid
,
ds
);
}
if
(
dslist
.
empty
()
)
...
...
include/UniSetTypes.h
View file @
a88afa45
...
...
@@ -30,6 +30,7 @@
#include <cstdio>
#include <string>
#include <list>
#include <vector>
#include <limits>
#include <ostream>
#include <unistd.h>
...
...
@@ -171,7 +172,7 @@ namespace UniSetTypes
/*! Разбивка строки по указанному символу */
IDList
explode
(
const
std
::
string
&
str
,
char
sep
=
','
);
std
::
list
<
std
::
string
>
explode_str
(
const
std
::
string
&
str
,
char
sep
=
','
);
std
::
vector
<
std
::
string
>
explode_str
(
const
std
::
string
&
str
,
char
sep
=
','
);
struct
ParamSInfo
{
...
...
src/Interfaces/UInterface.cc
View file @
a88afa45
...
...
@@ -1109,7 +1109,7 @@ void UInterface::CacheOfResolve::cache( const ObjectId id, const ObjectId node,
auto
it
=
mcache
.
find
(
k
);
if
(
it
==
mcache
.
end
()
)
mcache
.
insert
(
CacheMap
::
value_type
(
k
,
Info
(
ptr
)
));
mcache
.
emplace
(
k
,
Info
(
ptr
));
else
{
it
->
second
.
ptr
=
ptr
;
// CORBA::Object::_duplicate(ptr);
...
...
src/ObjectRepository/ObjectIndex_idXML.cc
View file @
a88afa45
...
...
@@ -168,8 +168,8 @@ void ObjectIndex_idXML::read_section( const std::shared_ptr<UniXML>& xml, const
inf
.
textName
=
uni_strdup
(
textname
);
inf
.
data
=
(
void
*
)(
xmlNode
*
)(
it
);
mok
.
insert
(
MapObjectKey
::
value_type
(
name
,
inf
.
id
));
// mok[name] = inf.id
;
omap
.
insert
(
MapObjects
::
value_type
(
inf
.
id
,
std
::
move
(
inf
)));
// omap[inf.id] = inf
;
mok
.
emplace
(
name
,
inf
.
id
)
;
omap
.
emplace
(
inf
.
id
,
std
::
move
(
inf
))
;
}
}
// ------------------------------------------------------------------------------------------
...
...
@@ -220,8 +220,8 @@ void ObjectIndex_idXML::read_nodes( const std::shared_ptr<UniXML>& xml, const st
inf
.
textName
=
uni_strdup
(
textname
);
inf
.
data
=
(
void
*
)(
xmlNode
*
)(
it
);
omap
.
insert
(
MapObjects
::
value_type
(
inf
.
id
,
inf
));
// omap[inf.id] = inf
;
mok
.
insert
(
MapObjectKey
::
value_type
(
name
,
inf
.
id
));
// mok[name] = inf.id
;
omap
.
emplace
(
inf
.
id
,
inf
)
;
mok
.
emplace
(
name
,
inf
.
id
)
;
}
}
// ------------------------------------------------------------------------------------------
...
...
src/ObjectRepository/ProxyManager.cc
View file @
a88afa45
...
...
@@ -57,7 +57,7 @@ void ProxyManager::attachObject( PassiveObject* po, UniSetTypes::ObjectId id )
auto
it
=
omap
.
find
(
id
);
if
(
it
==
omap
.
end
()
)
omap
.
insert
(
PObjectMap
::
value_type
(
id
,
po
)
);
omap
.
emplace
(
id
,
po
);
}
// -------------------------------------------------------------------------
void
ProxyManager
::
detachObject
(
UniSetTypes
::
ObjectId
id
)
...
...
src/ObjectRepository/UniSetTypes.cc
View file @
a88afa45
...
...
@@ -216,9 +216,9 @@ UniSetTypes::IDList UniSetTypes::explode( const string& str, char sep )
return
l
;
}
// -------------------------------------------------------------------------
std
::
list
<
std
::
string
>
UniSetTypes
::
explode_str
(
const
string
&
str
,
char
sep
)
std
::
vector
<
std
::
string
>
UniSetTypes
::
explode_str
(
const
string
&
str
,
char
sep
)
{
std
::
list
<
std
::
string
>
l
;
std
::
vector
<
std
::
string
>
v
;
string
::
size_type
prev
=
0
;
string
::
size_type
pos
=
0
;
...
...
@@ -230,13 +230,13 @@ std::list<std::string> UniSetTypes::explode_str( const string& str, char sep )
if
(
!
s
.
empty
()
)
{
l
.
emplace_back
(
s
);
v
.
emplace_back
(
s
);
prev
=
pos
+
1
;
}
}
while
(
pos
!=
string
::
npos
);
return
l
;
return
v
;
}
// ------------------------------------------------------------------------------------------
bool
UniSetTypes
::
is_digit
(
const
std
::
string
&
s
)
...
...
src/Processes/IOController.cc
View file @
a88afa45
...
...
@@ -395,7 +395,7 @@ void IOController::ioRegistration( std::shared_ptr<USensorInfo>& ainf, bool forc
ai
->
value
=
ai
->
default_val
;
// более оптимальный способ(при условии вставки первый раз)
ioList
.
insert
(
IOStateList
::
value_type
(
ainf
->
si
.
id
,
std
::
move
(
ai
)
));
ioList
.
emplace
(
IOStateList
::
value_type
(
ainf
->
si
.
id
,
std
::
move
(
ai
)
));
}
try
...
...
src/Processes/IONotifyController.cc
View file @
a88afa45
...
...
@@ -212,7 +212,7 @@ void IONotifyController::ask( AskMap& askLst, const UniSetTypes::ObjectId sid,
ConsumerListInfo
lst
;
// создаем новый список
addConsumer
(
lst
,
cons
);
// более оптимальный способ(при условии вставки первый раз)
askLst
.
insert
(
AskMap
::
value_type
(
sid
,
std
::
move
(
lst
)
));
askLst
.
emplace
(
sid
,
std
::
move
(
lst
));
try
{
...
...
@@ -565,7 +565,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp
}
// т.к. делаем move... то надо гарантировать, что дальше уже tli не используется..
askTMap
.
insert
(
AskThresholdMap
::
value_type
(
sid
,
std
::
move
(
tli
)
));
askTMap
.
emplace
(
sid
,
std
::
move
(
tli
));
}
else
{
...
...
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