English
Kamil Dudka

Share Library (C++)

Detail souboru

Jméno:StáhnoutSharedSegment_8h-source.html [Stáhnout]
Umístění: sharelib > api
Velikost:8.4 KB
Poslední změna:2022-09-09 13:06

Zdrojový kód

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ShareLibrary: sharelib/SharedSegment.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.2 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</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>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<div class="tabs">
  <ul>
    <li><a href="files.html"><span>File&nbsp;List</span></a></li>
    <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
  </ul>
</div>
<h1>sharelib/SharedSegment.h</h1><a href="SharedSegment_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef SHARED_SEGMENT_H</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define SHARED_SEGMENT_H</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00012"></a>00012 <span class="preprocessor">#if !defined _LINUX &amp;&amp; !defined _WIN32</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#  error "Platform was not specified. Add macro _LINUX or _WIN32 to compiler options."</span>
<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00015"></a>00015 <span class="preprocessor"></span>
<a name="l00016"></a>00016 <span class="preprocessor">#include "<a class="code" href="sharelib_8h.html" title="Share library interface.">sharelib.h</a>"</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="preprocessor">#ifdef _WIN32</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#include &lt;windows.h&gt;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#endif  // _WIN32</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span>
<a name="l00022"></a>00022 <span class="keyword">namespace </span>Share {
<a name="l00023"></a>00023 <span class="preprocessor">#ifdef _WIN32</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span>  <span class="keyword">typedef</span> HANDLE SegmentId;   
<a name="l00025"></a>00025 <span class="preprocessor">#endif  // _WIN32</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00027"></a>00027 <span class="preprocessor">#ifdef _LINUX</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span>  <span class="keyword">typedef</span> <span class="keywordtype">int</span> SegmentId;      
<a name="l00029"></a>00029 <span class="preprocessor">#endif // _LINUX</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span>
<a name="l00036"></a><a class="code" href="classShare_1_1SharedSegment.html">00036</a>   <span class="keyword">class </span><a class="code" href="classShare_1_1SharedSegment.html" title="Platform independent shared segment representation.">SharedSegment</a> {
<a name="l00037"></a>00037     <span class="keyword">public</span>:
<a name="l00046"></a>00046       <a class="code" href="sharelib_8h.html#b7233d110fa17b8069b9a9f14d91618f">SHARE_EXPORT</a> <a class="code" href="classShare_1_1SharedSegment.html#f76d62c2fee51190a95b28ced330a546" title="Create and attach new shared segment with given name and size.">SharedSegment</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="classShare_1_1SharedSegment.html#2c0f33002b07e8d03074d9c202edd69a" title="Return name of shared segment.">name</a>, <span class="keywordtype">size_t</span> size) <span class="keywordflow">throw</span> (<a class="code" href="classShare_1_1ShareException.html" title="General exception carrying text message inside.">ShareException</a>);
<a name="l00047"></a>00047 
<a name="l00054"></a>00054       <a class="code" href="sharelib_8h.html#b7233d110fa17b8069b9a9f14d91618f">SHARE_EXPORT</a> <a class="code" href="classShare_1_1SharedSegment.html#f76d62c2fee51190a95b28ced330a546" title="Create and attach new shared segment with given name and size.">SharedSegment</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *name) <span class="keywordflow">throw</span> (<a class="code" href="classShare_1_1ShareException.html" title="General exception carrying text message inside.">ShareException</a>);
<a name="l00055"></a>00055 
<a name="l00059"></a>00059       <a class="code" href="sharelib_8h.html#b7233d110fa17b8069b9a9f14d91618f">SHARE_EXPORT</a> <a class="code" href="classShare_1_1SharedSegment.html#dba89073f74148a74c4fcb903093449c" title="Detach from shared segment.">~SharedSegment</a> () <span class="keywordflow">throw</span> ();
<a name="l00060"></a>00060 
<a name="l00064"></a><a class="code" href="classShare_1_1SharedSegment.html#2c0f33002b07e8d03074d9c202edd69a">00064</a>       <a class="code" href="sharelib_8h.html#b7233d110fa17b8069b9a9f14d91618f">SHARE_EXPORT</a> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classShare_1_1SharedSegment.html#2c0f33002b07e8d03074d9c202edd69a" title="Return name of shared segment.">name</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> szName_; }
<a name="l00065"></a>00065 
<a name="l00069"></a><a class="code" href="classShare_1_1SharedSegment.html#80325577f1be0f6cc94eb598923b3510">00069</a>       <a class="code" href="sharelib_8h.html#b7233d110fa17b8069b9a9f14d91618f">SHARE_EXPORT</a> <span class="keywordtype">void</span>* <a class="code" href="classShare_1_1SharedSegment.html#80325577f1be0f6cc94eb598923b3510" title="Return attached shared segment address.">atAddress</a> ()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> atAddr_; }
<a name="l00070"></a>00070 
<a name="l00075"></a>00075       <a class="code" href="sharelib_8h.html#b7233d110fa17b8069b9a9f14d91618f">SHARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="classShare_1_1SharedSegment.html#163d57fcad780c64f8dd9719096220a5" title="Destroy shared segment.">destroy</a> ();
<a name="l00076"></a>00076 
<a name="l00077"></a>00077     <span class="keyword">private</span>:
<a name="l00078"></a>00078       <a class="code" href="classShare_1_1SharedSegment.html#f76d62c2fee51190a95b28ced330a546" title="Create and attach new shared segment with given name and size.">SharedSegment</a> (<span class="keyword">const</span> <a class="code" href="classShare_1_1SharedSegment.html" title="Platform independent shared segment representation.">SharedSegment</a>&amp;);                 
<a name="l00079"></a>00079       <span class="keywordtype">void</span> operator= (<span class="keyword">const</span> <a class="code" href="classShare_1_1SharedSegment.html" title="Platform independent shared segment representation.">SharedSegment</a>&amp;);                
<a name="l00080"></a>00080 
<a name="l00081"></a>00081     <span class="keyword">private</span>:
<a name="l00082"></a>00082       SegmentId id_;
<a name="l00083"></a>00083       <span class="keywordtype">char</span> *szName_;
<a name="l00084"></a>00084       <span class="keywordtype">void</span> *atAddr_;
<a name="l00085"></a>00085 
<a name="l00086"></a>00086     <span class="keyword">private</span>:
<a name="l00087"></a>00087       <span class="keywordtype">void</span> setName (<span class="keyword">const</span> <span class="keywordtype">char</span> *name);
<a name="l00088"></a>00088       <span class="keywordtype">void</span> attach ();
<a name="l00089"></a>00089   };  <span class="comment">// (class SharedSegment)</span>
<a name="l00090"></a>00090 
<a name="l00091"></a>00091 } <span class="comment">// (namespace Share)</span>
<a name="l00092"></a>00092 
<a name="l00093"></a>00093 <span class="preprocessor">#endif // SHARED_SEGMENT_H</span>
</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 26 17:42:59 2007 for ShareLibrary by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.2 </small></address>
</body>
</html>