<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Boost managed shared memory erstes Element der Map im Client]]></title><description><![CDATA[<p>Hallo um nicht eine neuen Thread heir mien problem:</p>
<p>Ich habe mit boost ein shared map erstellt nun will auf das erste element dieser im Client zugreifen. Die Veispiele hab ich schon durch aber komm inicht drauf.</p>
<p>server</p>
<pre><code class="language-cpp">typedef int    KeyType;
    typedef package  MappedType;
    typedef std::pair&lt;int, package&gt; ValueType;

	typedef boost::interprocess::allocator&lt;ValueType, managed_shared_memory::segment_manager&gt;	ShmAllocator;
	typedef boost::interprocess::map&lt;KeyType, MappedType, std::less&lt;KeyType&gt;, ShmAllocator&gt; packageMap;

	boost::interprocess::shared_memory_object::remove(&quot;shared_memory&quot;); 
	boost::interprocess::managed_shared_memory managed_shm(boost::interprocess::create_only, &quot;shared_memory&quot;, 5120); 
	ShmAllocator alloc_inst (managed_shm.get_segment_manager());

	packageMap *myPackageMap = managed_shm.construct&lt;packageMap&gt;(&quot;Pack&quot;)(std::less&lt;int&gt;(),alloc_inst);

////////////////////////////////////////////////////////////////////////////////////////////////
    for(int i = 0; i &lt; 6; ++i)
	{
		myPackageMap-&gt;insert(std::pair&lt;int, package&gt;(i, temp_test_pack));
    }

	packageMap::iterator it;
	for (it = myPackageMap-&gt;begin(); it != myPackageMap-&gt;end(); it++)
	{
		cout &lt;&lt; it-&gt;first &lt;&lt; endl;
		//cout &lt;&lt; it-&gt;second &lt;&lt; endl;
		cout &lt;&lt; &quot;LIID&quot; &lt;&lt;it-&gt;second.LIID&lt;&lt; endl;
	}
</code></pre>
<p>Hier geht die ausgabe nun will ich im Client die ausgabe machen dazu folgender Code</p>
<pre><code class="language-cpp">try {

						typedef int    KeyType;
						typedef package  MappedType;
						typedef std::pair&lt;int, package&gt; ValueType;

						typedef boost::interprocess::allocator&lt;ValueType, managed_shared_memory::segment_manager&gt;	ShmAllocator;
						typedef boost::interprocess::map&lt;KeyType, MappedType, std::less&lt;KeyType&gt;, ShmAllocator&gt; packageMap;

						boost::interprocess::managed_shared_memory managed_shm(boost::interprocess::open_only, &quot;shared_memory&quot;);
						ShmAllocator alloc_inst (managed_shm.get_segment_manager());

						packageMap *myPackageMap = 

							//steigt aus weil objekt schon verhanden.
							// benötigt zeiger oder ähnliches auf erstes Element der schon bestehtenden Map.
							managed_shm.construct&lt;packageMap&gt; (&quot;Pack&quot;)(std::less&lt;int&gt;(),alloc_inst);

						packageMap::iterator it;

						for (it = myPackageMap-&gt;begin(); it != myPackageMap-&gt;end(); it++)
						{
							cout &lt;&lt; it-&gt;first &lt;&lt; endl;
							//cout &lt;&lt; it-&gt;second &lt;&lt; endl;
							cout &lt;&lt; &quot;LIID&quot; &lt;&lt;it-&gt;second.LIID&lt;&lt; endl;
						}

					}
</code></pre>
<p>Weiß jemand was ich dem zeiger packageMap *myPackageMap = zuweisen muß damit es funktioniert?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/275198/boost-managed-shared-memory-erstes-element-der-map-im-client</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 02:53:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/275198.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 11 Oct 2010 09:15:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Boost managed shared memory erstes Element der Map im Client on Tue, 12 Oct 2010 09:49:35 GMT]]></title><description><![CDATA[<p>Hallo um nicht eine neuen Thread heir mien problem:</p>
<p>Ich habe mit boost ein shared map erstellt nun will auf das erste element dieser im Client zugreifen. Die Veispiele hab ich schon durch aber komm inicht drauf.</p>
<p>server</p>
<pre><code class="language-cpp">typedef int    KeyType;
    typedef package  MappedType;
    typedef std::pair&lt;int, package&gt; ValueType;

	typedef boost::interprocess::allocator&lt;ValueType, managed_shared_memory::segment_manager&gt;	ShmAllocator;
	typedef boost::interprocess::map&lt;KeyType, MappedType, std::less&lt;KeyType&gt;, ShmAllocator&gt; packageMap;

	boost::interprocess::shared_memory_object::remove(&quot;shared_memory&quot;); 
	boost::interprocess::managed_shared_memory managed_shm(boost::interprocess::create_only, &quot;shared_memory&quot;, 5120); 
	ShmAllocator alloc_inst (managed_shm.get_segment_manager());

	packageMap *myPackageMap = managed_shm.construct&lt;packageMap&gt;(&quot;Pack&quot;)(std::less&lt;int&gt;(),alloc_inst);

////////////////////////////////////////////////////////////////////////////////////////////////
    for(int i = 0; i &lt; 6; ++i)
	{
		myPackageMap-&gt;insert(std::pair&lt;int, package&gt;(i, temp_test_pack));
    }

	packageMap::iterator it;
	for (it = myPackageMap-&gt;begin(); it != myPackageMap-&gt;end(); it++)
	{
		cout &lt;&lt; it-&gt;first &lt;&lt; endl;
		//cout &lt;&lt; it-&gt;second &lt;&lt; endl;
		cout &lt;&lt; &quot;LIID&quot; &lt;&lt;it-&gt;second.LIID&lt;&lt; endl;
	}
</code></pre>
<p>Hier geht die ausgabe nun will ich im Client die ausgabe machen dazu folgender Code</p>
<pre><code class="language-cpp">try {

						typedef int    KeyType;
						typedef package  MappedType;
						typedef std::pair&lt;int, package&gt; ValueType;

						typedef boost::interprocess::allocator&lt;ValueType, managed_shared_memory::segment_manager&gt;	ShmAllocator;
						typedef boost::interprocess::map&lt;KeyType, MappedType, std::less&lt;KeyType&gt;, ShmAllocator&gt; packageMap;

						boost::interprocess::managed_shared_memory managed_shm(boost::interprocess::open_only, &quot;shared_memory&quot;);
						ShmAllocator alloc_inst (managed_shm.get_segment_manager());

						packageMap *myPackageMap = 

							//steigt aus weil objekt schon verhanden.
							// benötigt zeiger oder ähnliches auf erstes Element der schon bestehtenden Map.
							managed_shm.construct&lt;packageMap&gt; (&quot;Pack&quot;)(std::less&lt;int&gt;(),alloc_inst);

						packageMap::iterator it;

						for (it = myPackageMap-&gt;begin(); it != myPackageMap-&gt;end(); it++)
						{
							cout &lt;&lt; it-&gt;first &lt;&lt; endl;
							//cout &lt;&lt; it-&gt;second &lt;&lt; endl;
							cout &lt;&lt; &quot;LIID&quot; &lt;&lt;it-&gt;second.LIID&lt;&lt; endl;
						}

					}
</code></pre>
<p>Weiß jemand was ich dem zeiger packageMap *myPackageMap = zuweisen muß damit es funktioniert?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1963746</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1963746</guid><dc:creator><![CDATA[free118]]></dc:creator><pubDate>Tue, 12 Oct 2010 09:49:35 GMT</pubDate></item><item><title><![CDATA[Reply to Boost managed shared memory erstes Element der Map im Client on Mon, 11 Oct 2010 09:42:09 GMT]]></title><description><![CDATA[<p>Guck Dir die Beispiele an in der Boost Doku oder hier:<br />
<a href="http://www.highscore.de/cpp/boost/" rel="nofollow">http://www.highscore.de/cpp/boost/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1963752</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1963752</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Mon, 11 Oct 2010 09:42:09 GMT</pubDate></item><item><title><![CDATA[Reply to Boost managed shared memory erstes Element der Map im Client on Mon, 11 Oct 2010 12:52:26 GMT]]></title><description><![CDATA[<p>das hab ich schon.<br />
Mir ist nur leider nicht klar wie das mit der .find methode funktioniert in meinem Fall.<br />
Bzw. wie ich bei einer leeren Liste auf den &quot;anfang&quot; komme</p>
<p>Wäre cool wenn mir vllt doch jemand helfen könnte, ich beiß mir heute schon den ganzen tag die Zähne aus und komme nicht weiter.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1963789</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1963789</guid><dc:creator><![CDATA[free118]]></dc:creator><pubDate>Mon, 11 Oct 2010 12:52:26 GMT</pubDate></item><item><title><![CDATA[Reply to Boost managed shared memory erstes Element der Map im Client on Tue, 12 Oct 2010 08:02:13 GMT]]></title><description><![CDATA[<p><a href="http://www.boost.org/doc/libs/1_38_0/boost/interprocess/managed_shared_memory.hpp" rel="nofollow">http://www.boost.org/doc/libs/1_38_0/boost/interprocess/managed_shared_memory.hpp</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1964186</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1964186</guid><dc:creator><![CDATA[boost]]></dc:creator><pubDate>Tue, 12 Oct 2010 08:02:13 GMT</pubDate></item></channel></rss>