Search the web
Sign In
New User? Sign Up
ace-users
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
[ace-users] Assistance Using the ACE_Shared_Memory class/ACE_Shared   Message List  
Reply | Forward Message #42974 of 42992 |
ACE Users,

I am NOT including a PRF form since this question does
NOT include any references to compile/link/or
execution concerns of ACE.

I am on a project now that requires the OS Facade
wrapper C++ class of POSIX Shared Memory.

I unfortunately CANNOT use ACE because management
already has an infrastruture in place and are PARANOID
in using 3rd Party Software (Commercial or Open
Source).

If it were my decision I would use ACE, but it is not.

I have received an interface from a developer no
longer at the company which I now have carte blanche
to redo or reuse and subsequently develop delegation
code that will simply call the appropriate POSIX
shared memory functions to perform the lower level
work.

If I cannot use ACE (there unfortunately is NO
discussion regarding swaying management's opinion), I
would like to develop this C++ Shared Memory (POSIX
Compliant) class in the "ACE Style" as per ACE
Software Development Guidelines to at least mimic the
ACE Shared Memory class and its required
collaborators.

Here is the older interface that I have received.



template <typename DATA, typename LOCK>
class c_SharedMemory
{
public:
c_SharedMemory(int32_type key,
int32_type size,
int32_type shmflg,
std::string owner);

~c_SharedMemory();

//Read and Write to Shared Memory

DATA* Read(int32_type offset);
DATA* AtomicReadLocked(int32_type offset);
void Write(int32_type, DATA* data);
void AtomicWriteLocked(int32_type offset, DATA*
data);
bool Detach();
in32_type GetSize();

private:
int32_type m_BaseAddress;
int32_type m_Key;
int32_type m_SharedMemoryId;
std::string m_Owner;
LOCK m_Lock; //Strategize Lock
};


I have seen the ACE_Shared_Memory.h and ACE_Mem_Map
but I do NOT see any "read" and "write" methods to
update the pointer that eventually modifies the mapped
file.

I see in ACE_Shared_Memory:

public:

close(), remove(), malloc(), free(),
get_segment_size(), and get_id(), but where are the
read and write methods to modify or access the memory
mapped file region via the pointer?

I do not see a read/write combo like the class above.
Does the ACE_Shared_Memory class collaborate with
another class that does the actual read/write to
memory mapped file in shared memory?

The ACE_Shared_Memory_MM class also does NOT have the
read/write methods to access or modify the designated
shared memory or memory mapped file in shared memory
via the pointer.

I see the ACE_Shared_Memory_MM delegates all the work
to the ACE_Mem_Map class. I now see the ACE_Mem_Map
class with the map() methods, unmap() methods,
protect(), advise() etc, but again I do not see any
methods that would allow a user of a Shared Memory
object to obj.write() and obj.read() to/from Shared
Memory.

Can someone PLEASE help me out here on how to actually
read/write to this ACE_Shared_Memory component so I
can define a non-ACE version that stylistically
follows this ACE_Shared_Memory [pure
virtual]/ACE_Shared_Memory_MM/ACE_Mem_Map
collaboration, but I would like to know where a client
of this class component structure can simply call a
read or write to the shared memory.


Steve Huston, if you are out there, PLEASE HELP SIR as
I know you are most generous with your insightful
responses.

Thanks,

Tom Wallick




__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com



Sat Oct 8, 2005 3:07 am

tomwallick@...
Send Email Send Email

Forward
Message #42974 of 42992 |
Expand Messages Author Sort by Date

ACE Users, I am NOT including a PRF form since this question does NOT include any references to compile/link/or execution concerns of ACE. I am on a project...
Tom Wallick
tomwallick@...
Send Email
Oct 8, 2005
3:12 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help