Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ipaaca
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Ramin Yaghoubzadeh Torky
ipaaca
Commits
6a0076cd
Commit
6a0076cd
authored
12 years ago
by
Ramin Yaghoubzadeh
Browse files
Options
Downloads
Patches
Plain Diff
Still more c++
parent
8dc0b0e4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cpp/src/ipaaca.cc
+44
-9
44 additions, 9 deletions
cpp/src/ipaaca.cc
cpp/src/ipaaca.h
+5
-2
5 additions, 2 deletions
cpp/src/ipaaca.h
with
49 additions
and
11 deletions
cpp/src/ipaaca.cc
+
44
−
9
View file @
6a0076cd
...
...
@@ -22,12 +22,17 @@ void initialize_ipaaca_rsb()
Factory
::
getInstance
().
setDefaultParticipantConfig
(
config
);
boost
::
shared_ptr
<
IUConverter
>
iu_converter
(
new
IUConverter
());
boost
::
shared_ptr
<
IUPayloadUpdateConverter
>
payload_update_converter
(
new
IUPayloadUpdateConverter
());
boost
::
shared_ptr
<
IULinkUpdateConverter
>
link_update_converter
(
new
IULinkUpdateConverter
());
stringConverterRepository
()
->
registerConverter
(
iu_converter
);
boost
::
shared_ptr
<
IUPayloadUpdateConverter
>
payload_update_converter
(
new
IUPayloadUpdateConverter
());
stringConverterRepository
()
->
registerConverter
(
payload_update_converter
);
boost
::
shared_ptr
<
IULinkUpdateConverter
>
link_update_converter
(
new
IULinkUpdateConverter
());
stringConverterRepository
()
->
registerConverter
(
link_update_converter
);
boost
::
shared_ptr
<
ProtocolBufferConverter
<
protobuf
::
IUCommission
>
>
iu_commission_converter
(
new
ProtocolBufferConverter
<
protobuf
::
IUCommission
>
());
stringConverterRepository
()
->
registerConverter
(
iu_commission_converter
);
//IPAACA_TODO("initialize all converters")
}
/*
...
...
@@ -127,31 +132,61 @@ void SmartLinkMap::_replace_links(const LinkMap& links)
//}}}
// Buffer//{{{
void
Buffer
::
_allocate_unique_name
(
const
std
::
string
&
basename
)
{
void
Buffer
::
_allocate_unique_name
(
const
std
::
string
&
basename
,
const
std
::
string
&
function
)
{
std
::
string
uuid
=
ipaaca
::
generate_uuid_string
();
std
::
string
name
=
basename
+
"-"
+
uuid
.
substr
(
0
,
8
);
_unique_name
=
name
;
_basename
=
basename
;
_uuid
=
uuid
.
substr
(
0
,
8
);
_unique_name
=
basename
+
"ID"
+
_uuid
+
"/"
+
function
;
}
//}}}
// OutputBuffer//{{{
OutputBuffer
::
OutputBuffer
(
const
std
::
string
&
basename
)
:
Buffer
(
basename
)
:
Buffer
(
basename
,
"OB"
)
{
_id_prefix
=
_basename
+
"-"
+
_uuid
+
"-IU-"
;
}
void
OutputBuffer
::
_send_iu_link_update
(
IUInterface
*
iu
,
bool
is_delta
,
revision_t
revision
,
const
LinkMap
&
new_links
,
const
LinkMap
&
links_to_remove
,
const
std
::
string
&
writer_name
)
{
IPAACA_IMPLEMENT_ME
IULinkUpdate
*
lup
=
new
ipaaca
::
IULinkUpdate
();
Informer
<
ipaaca
::
IULinkUpdate
>::
DataPtr
ldata
(
lup
);
lup
->
uid
=
iu
->
uid
();
lup
->
is_delta
=
is_delta
;
lup
->
revision
=
revision
;
lup
->
is_delta
=
true
;
lup
->
new_links
=
new_links
;
if
(
is_delta
)
lup
->
links_to_remove
=
links_to_remove
;
lup
->
writer_name
=
writer_name
;
Informer
<
AnyType
>::
Ptr
informer
=
_get_informer
(
iu
->
category
());
informer
->
publish
(
ldata
);
}
void
OutputBuffer
::
_send_iu_payload_update
(
IUInterface
*
iu
,
bool
is_delta
,
revision_t
revision
,
const
std
::
map
<
std
::
string
,
std
::
string
>&
new_items
,
const
std
::
vector
<
std
::
string
>&
keys_to_remove
,
const
std
::
string
&
writer_name
)
{
IPAACA_IMPLEMENT_ME
IUPayloadUpdate
*
pup
=
new
ipaaca
::
IUPayloadUpdate
();
Informer
<
ipaaca
::
IUPayloadUpdate
>::
DataPtr
pdata
(
pup
);
pup
->
uid
=
iu
->
uid
();
pup
->
is_delta
=
is_delta
;
pup
->
revision
=
revision
;
pup
->
new_items
=
new_items
;
if
(
is_delta
)
pup
->
keys_to_remove
=
keys_to_remove
;
pup
->
writer_name
=
writer_name
;
Informer
<
AnyType
>::
Ptr
informer
=
_get_informer
(
iu
->
category
());
informer
->
publish
(
pdata
);
}
void
OutputBuffer
::
_send_iu_commission
(
IUInterface
*
iu
,
revision_t
revision
,
const
std
::
string
&
writer_name
)
{
IPAACA_IMPLEMENT_ME
Informer
<
protobuf
::
IUCommission
>::
DataPtr
data
(
new
protobuf
::
IUCommission
());
data
->
set_uid
(
iu
->
uid
());
data
->
set_revision
(
revision
);
data
->
set_writer_name
(
writer_name
);
Informer
<
AnyType
>::
Ptr
informer
=
_get_informer
(
iu
->
category
());
informer
->
publish
(
data
);
}
void
OutputBuffer
::
add
(
IU
::
ref
iu
)
{
//IPAACA_IMPLEMENT_ME
...
...
This diff is collapsed.
Click to expand it.
cpp/src/ipaaca.h
+
5
−
2
View file @
6a0076cd
...
...
@@ -137,14 +137,16 @@ class Buffer { //: public boost::enable_shared_from_this<Buffer> {
friend
class
IU
;
friend
class
RemotePushIU
;
protected:
std
::
string
_uuid
;
std
::
string
_basename
;
std
::
string
_unique_name
;
protected:
_IPAACA_ABSTRACT_
virtual
void
_send_iu_link_update
(
IUInterface
*
iu
,
bool
is_delta
,
revision_t
revision
,
const
LinkMap
&
new_links
,
const
LinkMap
&
links_to_remove
,
const
std
::
string
&
writer_name
=
"undef"
)
=
0
;
_IPAACA_ABSTRACT_
virtual
void
_send_iu_payload_update
(
IUInterface
*
iu
,
bool
is_delta
,
revision_t
revision
,
const
std
::
map
<
std
::
string
,
std
::
string
>&
new_items
,
const
std
::
vector
<
std
::
string
>&
keys_to_remove
,
const
std
::
string
&
writer_name
=
"undef"
)
=
0
;
_IPAACA_ABSTRACT_
virtual
void
_send_iu_commission
(
IUInterface
*
iu
,
revision_t
revision
,
const
std
::
string
&
writer_name
=
"undef"
)
=
0
;
void
_allocate_unique_name
(
const
std
::
string
&
basename
);
inline
Buffer
(
const
std
::
string
&
basename
)
{
_allocate_unique_name
(
basename
);
inline
Buffer
(
const
std
::
string
&
basename
,
const
std
::
string
&
function
)
{
_allocate_unique_name
(
basename
,
function
);
}
public
:
virtual
inline
~
Buffer
()
{
}
...
...
@@ -158,6 +160,7 @@ class OutputBuffer: public Buffer { //, public boost::enable_shared_from_this<Ou
protected:
std
::
map
<
std
::
string
,
Informer
<
AnyType
>::
Ptr
>
_informer_store
;
IUStore
_iu_store
;
Lock
_iu_id_counter_lock
;
protected:
// informing functions
void
_send_iu_link_update
(
IUInterface
*
iu
,
bool
is_delta
,
revision_t
revision
,
const
LinkMap
&
new_links
,
const
LinkMap
&
links_to_remove
,
const
std
::
string
&
writer_name
=
"undef"
);
...
...
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