Added documentation.
This commit is contained in:
parent
15067ab4ec
commit
04388c04b8
@ -28,18 +28,24 @@ namespace neocomm {
|
||||
|
||||
class channel {
|
||||
public:
|
||||
/**
|
||||
* @brief Initialize a channel object (this should pretty
|
||||
* much only be done by the node object).
|
||||
*
|
||||
* @param name Name of the channel.
|
||||
* @param network A pointer to the OpenDHT node.
|
||||
*/
|
||||
channel(const std::string &name, dht::DhtRunner *network);
|
||||
~channel();
|
||||
|
||||
/**
|
||||
* @brief Get the name of the channel.
|
||||
*
|
||||
* @return The name of the channel.
|
||||
*/
|
||||
inline std::string get_name() const {
|
||||
return name;
|
||||
}
|
||||
//inline dht::InfoHash get_key() const {
|
||||
//return key;
|
||||
//}
|
||||
//inline size_t get_token() {
|
||||
//return token.get();
|
||||
//}
|
||||
|
||||
private:
|
||||
const std::string name;
|
||||
|
@ -64,9 +64,45 @@ public:
|
||||
*/
|
||||
void export_nodes(const std::string &file_path); // TODO
|
||||
|
||||
/**
|
||||
* @brief Join a channel.
|
||||
*
|
||||
* @param name Name of the channel.
|
||||
*
|
||||
* @note If the channel is already joined on this node
|
||||
* then it does nothing and returns a nullptr.
|
||||
*
|
||||
* @return Returns a pointer to the channel object.
|
||||
*/
|
||||
channel *join_channel(const std::string &name);
|
||||
/**
|
||||
* @brief Get a pointer to a channel object by name.
|
||||
*
|
||||
* @param name The name of the channel.
|
||||
*
|
||||
* @note If the channel has not been joined on this node
|
||||
* then it returns nullptr.
|
||||
*
|
||||
* @return A pointer to the channel object.
|
||||
*/
|
||||
channel *get_channel(const std::string &name);
|
||||
/**
|
||||
* @brief Leave a channel by name.
|
||||
*
|
||||
* @note If the channel has not been joined on this node
|
||||
* it does nothing.
|
||||
*
|
||||
* @param name The name of the channel.
|
||||
*/
|
||||
void leave_channel(const std::string &name);
|
||||
/**
|
||||
* @brief Leave a channel by pointer to the object.
|
||||
*
|
||||
* @note If the channel has not been joined on this node
|
||||
* it does nothing.
|
||||
*
|
||||
* @param chan The channel object.
|
||||
*/
|
||||
inline void leave_channel(channel *chan) {
|
||||
leave_channel(chan->get_name());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user