-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from lkpworkspace/dev
v0.8.1
- Loading branch information
Showing
25 changed files
with
920 additions
and
453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
@PACKAGE_INIT@ | ||
|
||
include ( "${CMAKE_CURRENT_LIST_DIR}/myframeTargets.cmake" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# 版本发布 | ||
* 修改CMakeLists.txt中版本号 | ||
* 提交修改 | ||
* 合入master | ||
* 生成版本tag并发布 | ||
* 发布tag中详细描述版本更新内容 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/**************************************************************************** | ||
Copyright (c) 2018, likepeng | ||
All rights reserved. | ||
Author: likepeng <likepeng0418@163.com> | ||
****************************************************************************/ | ||
#include <chrono> | ||
#include <random> | ||
#include <thread> | ||
#include <unordered_map> | ||
|
||
#include <glog/logging.h> | ||
|
||
#include "myframe/msg.h" | ||
#include "myframe/actor.h" | ||
|
||
class ExampleActorPub : public myframe::Actor { | ||
public: | ||
int Init(const char* param) override { | ||
(void)param; | ||
Timeout("1000ms", 100); | ||
return 0; | ||
} | ||
|
||
void Proc(const std::shared_ptr<const myframe::Msg>& msg) override { | ||
if (msg->GetType() == "SUBSCRIBE") { | ||
pub_list_.push_back(msg->GetSrc()); | ||
return; | ||
} | ||
if (msg->GetType() == "TIMER") { | ||
auto mailbox = GetMailbox(); | ||
for (size_t i = 0; i < pub_list_.size(); ++i) { | ||
mailbox->Send(pub_list_[i], | ||
std::make_shared<myframe::Msg>("pub msg")); | ||
} | ||
Timeout("1000ms", 100); | ||
} | ||
} | ||
private: | ||
std::vector<std::string> pub_list_; | ||
}; | ||
|
||
class ExampleActorSub : public myframe::Actor { | ||
public: | ||
int Init(const char* param) override { | ||
(void)param; | ||
Subscribe("actor.example_b_pub.#1"); | ||
return 0; | ||
} | ||
|
||
void Proc(const std::shared_ptr<const myframe::Msg>& msg) override { | ||
LOG(INFO) << "-----> get pub msg: " << *msg; | ||
} | ||
}; | ||
|
||
extern "C" std::shared_ptr<myframe::Actor> actor_create( | ||
const std::string& actor_name) { | ||
if (actor_name == "example_b_pub") { | ||
return std::make_shared<ExampleActorPub>(); | ||
} | ||
if (actor_name == "example_a_sub") { | ||
return std::make_shared<ExampleActorSub>(); | ||
} | ||
return nullptr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"type":"library", | ||
"lib":"libexample_actor_subscribe.so", | ||
"actor":{ | ||
"example_b_pub":[ | ||
{ | ||
"instance_name":"#1", | ||
"instance_params":"" | ||
} | ||
], | ||
"example_a_sub":[ | ||
{ | ||
"instance_name":"#1", | ||
"instance_params":"" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.