<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>DTN Reference Implementation: TcaEndpointID.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.6 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <h1>TcaEndpointID.h</h1><a href="servlib_2routing_2TcaEndpointID_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> * Copyright 2005-2006 University of Waterloo</span> <a name="l00003"></a>00003 <span class="comment"> * </span> <a name="l00004"></a>00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span> <a name="l00005"></a>00005 <span class="comment"> * you may not use this file except in compliance with the License.</span> <a name="l00006"></a>00006 <span class="comment"> * You may obtain a copy of the License at</span> <a name="l00007"></a>00007 <span class="comment"> * </span> <a name="l00008"></a>00008 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span> <a name="l00009"></a>00009 <span class="comment"> * </span> <a name="l00010"></a>00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span> <a name="l00011"></a>00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span> <a name="l00012"></a>00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span> <a name="l00013"></a>00013 <span class="comment"> * See the License for the specific language governing permissions and</span> <a name="l00014"></a>00014 <span class="comment"> * limitations under the License.</span> <a name="l00015"></a>00015 <span class="comment"> */</span> <a name="l00016"></a>00016 <a name="l00017"></a>00017 <a name="l00018"></a>00018 <span class="preprocessor">#ifndef _TCA_ENDPOINTID_H_</span> <a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#define _TCA_ENDPOINTID_H_</span> <a name="l00020"></a>00020 <span class="preprocessor"></span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="comment">// Warning: </span> <a name="l00023"></a>00023 <span class="comment">// There are 2 versions of the TcaEndpointID class, one which is a </span> <a name="l00024"></a>00024 <span class="comment">// subclass of EndpointID and is to be used on the servlib side.</span> <a name="l00025"></a>00025 <span class="comment">// The other is a stand-alone class to be used on the applib side.</span> <a name="l00026"></a>00026 <span class="comment">// The interface and functionality is otherwise the same.</span> <a name="l00027"></a>00027 <span class="comment">// It would be nice to merge these into a single class someday.</span> <a name="l00028"></a>00028 <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#include <string></span> <a name="l00031"></a>00031 <span class="preprocessor">#include "../../servlib/naming/EndpointID.h"</span> <a name="l00032"></a>00032 <a name="l00033"></a>00033 <span class="keyword">namespace </span>dtn { <a name="l00034"></a>00034 <a name="l00035"></a>00035 <a name="l00036"></a><a class="code" href="classdtn_1_1TcaEndpointID.html">00036</a> <span class="keyword">class </span><a class="code" href="classdtn_1_1TcaEndpointID.html">TcaEndpointID</a> : <span class="keyword">public</span> <a class="code" href="classdtn_1_1EndpointID.html">EndpointID</a> <a name="l00037"></a>00037 { <a name="l00038"></a>00038 <span class="keyword">public</span>: <a name="l00039"></a><a class="code" href="classdtn_1_1TcaEndpointID.html#794e3a83aa8dc2ee8efa5f87436c9047">00039</a> <a class="code" href="classdtn_1_1TcaEndpointID.html#794e3a83aa8dc2ee8efa5f87436c9047">TcaEndpointID</a>() : <a class="code" href="classdtn_1_1EndpointID.html">EndpointID</a>(), <a class="code" href="classdtn_1_1TcaEndpointID.html#2735adee0b6f75175a35e02f0853af8c">host_</a>(<span class="stringliteral">""</span>), <a class="code" href="classdtn_1_1TcaEndpointID.html#5544d5da619b4de56c6c685634a1f170">app_</a>(<span class="stringliteral">""</span>) { } <a name="l00040"></a>00040 <a class="code" href="classdtn_1_1TcaEndpointID.html#794e3a83aa8dc2ee8efa5f87436c9047">TcaEndpointID</a>(<span class="keyword">const</span> <a class="code" href="classdtn_1_1EndpointID.html">EndpointID</a>& eid); <a name="l00041"></a>00041 <a class="code" href="classdtn_1_1TcaEndpointID.html#794e3a83aa8dc2ee8efa5f87436c9047">TcaEndpointID</a>(<span class="keyword">const</span> std::string& <a class="code" href="classdtn_1_1EndpointID.html#e214dda88bf43a3576cfcdf76c77c5a9">str</a>); <a name="l00042"></a>00042 <a class="code" href="classdtn_1_1TcaEndpointID.html#794e3a83aa8dc2ee8efa5f87436c9047">TcaEndpointID</a>(<span class="keyword">const</span> std::string& <a class="code" href="classdtn_1_1TcaEndpointID.html#4ae4e32d1fdd24a0f991fa7ee36e69b6">host</a>, <span class="keyword">const</span> std::string& <a class="code" href="classdtn_1_1TcaEndpointID.html#239acd18c5985031ccde27d7b992a5bc">app</a>); <a name="l00043"></a>00043 <a class="code" href="classdtn_1_1TcaEndpointID.html#794e3a83aa8dc2ee8efa5f87436c9047">TcaEndpointID</a>(<span class="keyword">const</span> <a class="code" href="classdtn_1_1TcaEndpointID.html">TcaEndpointID</a>& eid); <a name="l00044"></a>00044 <a name="l00045"></a><a class="code" href="classdtn_1_1TcaEndpointID.html#4ae4e32d1fdd24a0f991fa7ee36e69b6">00045</a> <span class="keyword">const</span> std::string& <a class="code" href="classdtn_1_1TcaEndpointID.html#4ae4e32d1fdd24a0f991fa7ee36e69b6">host</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classdtn_1_1TcaEndpointID.html#2735adee0b6f75175a35e02f0853af8c">host_</a>; } <a name="l00046"></a><a class="code" href="classdtn_1_1TcaEndpointID.html#239acd18c5985031ccde27d7b992a5bc">00046</a> <span class="keyword">const</span> std::string& <a class="code" href="classdtn_1_1TcaEndpointID.html#239acd18c5985031ccde27d7b992a5bc">app</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classdtn_1_1TcaEndpointID.html#5544d5da619b4de56c6c685634a1f170">app_</a>; } <a name="l00047"></a>00047 <a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1TcaEndpointID.html#a769877f74538286466c0a8b9917ebd9">set_host</a>(<span class="keyword">const</span> std::string& <a class="code" href="classdtn_1_1TcaEndpointID.html#4ae4e32d1fdd24a0f991fa7ee36e69b6">host</a>); <a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1TcaEndpointID.html#b5fb4117a3c52a00d0e09e48b5dd8424">set_app</a>(<span class="keyword">const</span> std::string& <a class="code" href="classdtn_1_1TcaEndpointID.html#239acd18c5985031ccde27d7b992a5bc">app</a>); <a name="l00050"></a>00050 <a name="l00051"></a><a class="code" href="classdtn_1_1TcaEndpointID.html#6f23dbe9ea58f98704800431083d064c">00051</a> <span class="keyword">const</span> std::string <a class="code" href="classdtn_1_1TcaEndpointID.html#6f23dbe9ea58f98704800431083d064c">get_hostid</a>()<span class="keyword"> const</span> <a name="l00052"></a>00052 <span class="keyword"> </span>{ <span class="keywordflow">return</span> std::string(<span class="stringliteral">"tca://"</span>) + <a class="code" href="classdtn_1_1TcaEndpointID.html#2735adee0b6f75175a35e02f0853af8c">host_</a>; } <a name="l00053"></a>00053 <a name="l00054"></a>00054 <span class="keyword">static</span> <span class="keyword">inline</span> std::string <a name="l00055"></a><a class="code" href="classdtn_1_1TcaEndpointID.html#1c7786c09ffc5f8c4a1665b1411f722e">00055</a> <a class="code" href="classdtn_1_1TcaEndpointID.html#1c7786c09ffc5f8c4a1665b1411f722e">build</a>(<span class="keyword">const</span> std::string& <a class="code" href="classdtn_1_1TcaEndpointID.html#4ae4e32d1fdd24a0f991fa7ee36e69b6">host</a>, <span class="keyword">const</span> std::string& <a class="code" href="classdtn_1_1TcaEndpointID.html#239acd18c5985031ccde27d7b992a5bc">app</a>) <a name="l00056"></a>00056 { <span class="keywordflow">return</span> std::string(<span class="stringliteral">"tca://"</span>) + host + <span class="stringliteral">"/"</span> + app; } <a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="keyword">protected</span>: <a name="l00059"></a>00059 <span class="comment">// TcaEndpointID caches host part and app part for easy lookup, but</span> <a name="l00060"></a>00060 <span class="comment">// always maintains the base class strings as well.</span> <a name="l00061"></a><a class="code" href="classdtn_1_1TcaEndpointID.html#2735adee0b6f75175a35e02f0853af8c">00061</a> std::string <a class="code" href="classdtn_1_1TcaEndpointID.html#2735adee0b6f75175a35e02f0853af8c">host_</a>; <a name="l00062"></a><a class="code" href="classdtn_1_1TcaEndpointID.html#5544d5da619b4de56c6c685634a1f170">00062</a> std::string <a class="code" href="classdtn_1_1TcaEndpointID.html#5544d5da619b4de56c6c685634a1f170">app_</a>; <a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classdtn_1_1TcaEndpointID.html#f7f7f540269dc962eba0b58ab8f78126">parse</a>(); <a name="l00064"></a>00064 }; <a name="l00065"></a>00065 <a name="l00066"></a>00066 <a name="l00067"></a>00067 } <span class="comment">// namespace dtn</span> <a name="l00068"></a>00068 <a name="l00069"></a>00069 <span class="preprocessor">#endif </span><span class="comment">/* _TCA_ENDPOINTID_H_ */</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Mon Jul 21 14:09:47 2008 for DTN Reference Implementation by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> </body> </html>