Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

creating an exact copy of an object in memory

3 posts in Objects Last posting was on 2003-02-25 14:06:11.0Z
AA Posted on 2003-02-24 18:36:49.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: aa
Date: Mon, 24 Feb 2003 13:36:49 -0500
Subject: creating an exact copy of an object in memory
Lines: 10
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <364_7C6F3EC3348D1F0300663F7485256CD7.00663F8585256CD7@webforums>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub sybase.public.powerbuilder.objects:185
Article PK: 712760

To fix a problem in a app I am working on I need to create another "EXACT"
instance of an object. Therefore I will have two identical objects in
memory of the same type referenced by two different variables.

Is there an easy way to solve this problem, or do I need to create a clone
function and manually change the state of one object to the other?

Thank you in advance...

Andrew


"Tim Wallace" <reply Posted on 2003-02-24 21:26:18.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: "Tim Wallace" <reply@this_group.com>
Subject: Re: creating an exact copy of an object in memory
Date: Mon, 24 Feb 2003 16:26:18 -0500
Lines: 17
Organization: Solar Flare Software, Inc.
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: mail.pit-magnus.com 206.139.208.13
Message-ID: <364_oZJsf2E3CHA.262@forums.sybase.com>
References: <364_7C6F3EC3348D1F0300663F7485256CD7.00663F8585256CD7@webforums>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.powerbuilder.objects:622
Article PK: 713194

What are you trying to work around?

Tim

<aa> wrote in message
news:7C6F3EC3348D1F0300663F7485256CD7.00663F8585256CD7@webforums...
> To fix a problem in a app I am working on I need to create another "EXACT"
> instance of an object. Therefore I will have two identical objects in
> memory of the same type referenced by two different variables.
>
> Is there an easy way to solve this problem, or do I need to create a clone
> function and manually change the state of one object to the other?
>
> Thank you in advance...
>
> Andrew


AA Posted on 2003-02-25 14:06:11.0Z
Newsgroups: sybase.public.powerbuilder.objects
From: aa
Date: Tue, 25 Feb 2003 09:06:11 -0500
Subject: Re: creating an exact copy of an object in memory
Lines: 26
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <364_2F9BE15467FC65AD004D783D85256CD8.0079C1E885256CD7@webforums>
References: <364_7C6F3EC3348D1F0300663F7485256CD7.00663F8585256CD7@webforums> <364_oZJsf2E3CHA.262@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub sybase.public.powerbuilder.objects:7213
Article PK: 734497

Tim,
In the app there is a MessageDebugging obj that has an instance array of
Message obj, witch is has an instance var MessageStructure. In Message obj
we get a message from our server, which populates the MessageStructure, and
if valid we call MessageDebugging.addMessage(Value Message). Then we
proceed to process this Message obj for the app, the state of the Message
obj can change during this processing. When changes occur to the Message
obj the copy of the ref. var stored in the MessageDebugging obj also
reflects these changes, which is to be expected. However, when designed
the MessageDebugging obj was supposed to store "snapshots" of the incoming
and outgoing messages.
My solution was to create another instance of the Message obj and create an
of_clone(ref Message) function. In the of_clone function I manually copy
the state of the current message to the new local one where it's ref will
be stored in the MessageDebugging obj's instance array.
However, I still do not understand how to create an exact copy of another
object... This will lead to problems is I need to an instance var Object to
the other.?.?.?

Is there a better way to copy/duplicate mem space?
Or is there a better solution progamaticly that I am missing?

Sorry for any gram errors, I am not a spelling champ...

Thank you for your time,

Andrew