|
Ok, I think I understand what you are saying. This provides a method to transport the data (generically speaking) from point A to point B, is that correct?
Tomasz Sowinski wrote:
'From' side: usually, you have an 'object graph' - objects related to each other (parent/child relationships, etc). You need to 'flatten' this structure somehow, because you'll need a serial stream of bytes. See 'To' side.
Could you explain this a little more?
Nick Parker
|
|
|
|
|
I'm assuming that you want me to explain the 'object graph' thing.
Imagine that you have CDocument derived class. It usually contains some data. They may be integers, strings, arrays etc. Serializing them is easy - you're just writing/reading their binary representation.
Now - what happens when you have a pointer in your document? What if it points to an object which has a 'backpointer' to document? These objects connected together are called 'object graph'. Any serialization mechanism must be ready to deal with such situation. Two most important points are:
- you may have polymorphic objects and pointers of type 'CYourBaseObject *'. But pointers point to CYourConcreteType1 or CYetAnotherTypeDerivedFromYourBaseObject. On the deserialization side, you want the real type to be preserved.
- you may more than one pointer to the same object. Both sides of operation must be smart enough to serialize object data only once.
Luckily, as an user of MFC or .NET, you don't need to worry about such issues.
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
This is a flow chart of me trying to follow what you just said:
Tomasz Sowinski wrote:
Imagine that you have CDocument derived class. It usually contains some data. They may be integers, strings, arrays etc. Serializing them is easy - you're just writing/reading their binary representation.
Understood.
Tomasz Sowinski wrote:
Now - what happens when you have a pointer in your document?
Starting to get lost...
Tomasz Sowinski wrote:
What if it points to an object which has a 'backpointer' to document?
Fully lost now.
Tomasz Sowinski wrote:
These objects connected together are called 'object graph'.
Okay.
Tomasz Sowinski wrote:
Luckily, as an user of MFC or .NET, you don't need to worry about such issues.
Thank goodness, I thought I was going to have to be lost again.
Nick Parker
|
|
|
|
|
Nick Parker wrote:
Now - what happens when you have a pointer in your document?
Starting to get lost...
Quick example:
You have MFC doc/view app. Your doc class is CWidgetDoc. You've defined a CWidget class, which is a base for CBlueWidget, CTriangleWidget and CStereoWidget.
CWidget class has the following member variable:
CWidgetDoc *m_pParentDoc;
In your CWidgetDoc, you store unlimited number of widgets. You're using std::vector for that:
std::vector<CWidget *> m_widgets;
Your users work with the app and create blue/triangle/stereo widgets. m_widgets grows and contains pointers to different types of objects; all they have in common is the base class, CWidget.
There are pointers going from document to widget. There are pointers going from widgets to document. This is simple object graph - with complicated program, you'd have more tangled structure.
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Tomasz Sowinski wrote:
There are pointers going from document to widget. There are pointers going from widgets to document. This is simple object graph - with complicated program, you'd have more tangled structure.
Gotcha, thanks Tomasz
Nick Parker
|
|
|
|
|
Serialization (to make somthing serial) is transforming an (arbitrary complex) data structure from a random access data store (like memory) into a sequential stream of bytes (like a disk file). Deserialization consequently is the other way round.
Memory is a random access data store. This means that you can think of it as a big array of bytes and you can access any byte in this array through an index. This index is usually called the "address" of the byte. Any non-trivial data structure (like a tree) is spread over the memory, consisting of chunks which are connected to each other via pointers.
However, if you need to transmit your data through a serial line, like a network connection, you have to send it "byte per byte". This is called serialisation.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
I am going to use the clone method to make a duplicate.THe rs is supposed to be on that can support bookmarks. How do we find out if it can or not?
Do the two recordsets in question both have to be createInstance 'd?
Thanks,
ns
|
|
|
|
|
Hello everybody:
I have a Dialog with a combo box. I supposed to pick a value from the combo box and then when I close the dialog and open the same dialog again, the value that I was selected before closing the dialog is gone. Is there a way of keeping those values when opening and closing a dialog? Any answer is more than welcome.
Thanks and have a good day,
Luis E. Cuadrado
)
|
|
|
|
|
maybe you should use GetCurSel before destructing CDialog object and SetCurSel after creating CDialog again?
nobody is perfect
|
|
|
|
|
Are you using DDX_ routines in DoDataExchange, or rather you've done data transfer yourself?
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Hello:
Thanks for the reply. DDX_routines? I think I heard about those but I don't think I'm using those in my application. I was going to do data transfer my self but looks like DDX_ routines is the best way, I guess. Is there any resource over the internet that I can find about DDX_routines?
Thanks,
Luis E. Cuadrado
)
|
|
|
|
|
Ok, I'll try to keep it simple. Did you use ClassWizard to associate some variable with combo box? Or you're just calling Get/SetCurSel?
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Yes, I used ClassWizard to add a variable to the ComboBox. With that variable I call GetCurSel(). Sorry if my questions sound kind of newbie. I'm starting with MFC not long ago ).
Thanks,
Luis E. Cuadrado
)
|
|
|
|
|
Luis E. Cuadrado wrote:
With that variable I call GetCurSel().
Variable is 'control' (CComboBox) or 'value' (int)?
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
I want to convert emf to jpeg,png or gif.
So pl refer some urls. so i need dll
|
|
|
|
|
Chris Losingers company
http://www.smalleranimals.com/
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
I've never heard of 'emf' but I'm guessing its an image file format, so check out the Free Image project: http://www.6ixsoft.com[^]
Dylan Kenneally
London, UK
|
|
|
|
|
If you close the connection object, is the recordset stil available for use. My rs is generated like so:
m_pRecordsetPhoto->Open ((IDispatch *) m_pCommandPhoto, vtMissing, adOpenKeyset,
adLockOptimistic, -1);
I know very little about databases> does this declaration above indicate anything about its persistence when the conn is closed. I feel that if I close te conn, then later I cant go and quiz the database for something like rs->fields->item->value etc. because theres no connection.??
Thanks,
ns
|
|
|
|
|
hi,
Look at article: ADO at a glance on this website
for better understanding
DanielO
|
|
|
|
|
For the Gurus out there, is this code legal?
(class declarations have been stripped down)
<br />
class a<br />
{<br />
};<br />
<br />
class b : public a<br />
{<br />
};<br />
<br />
a *pa = (a*)new b;
<br />
Thanks,
James
Drinking In The Sun
Forgot Password?
|
|
|
|
|
I'd suggest you'd end up with the b constructor being called, then the class being downcast to an a*. I don't think you need the C style cast, it should work implicitly.
I'd write some code that outputs messages in the constructors and try it to see.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
b::b will be called. You don't need the cast. You'd need the cast if you'd derive b using private/protected inheritance.
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
As mentioned this is perfectly leagal and often usefull, especially in conjuction with virtual functions.
[James Pullicino] wrote:
Which constructor will be called?
The answer is both. b's constructor is called which then imediately calls a's.
class a<br />
{<br />
public:<br />
a() {cout << "A's Constructor\n";}<br />
};<br />
<br />
class b : public a<br />
{<br />
public:<br />
b() {cout << "B's Constructor\n";}<br />
}
If you are in doubt about some feature it is always a good idea to use print statements or better yet step through the code with a debugger. Posting your question on a message board is also a good idea.
|
|
|
|
|
i have an unsigned char array which has certain data. I want that data of the array to be displayed in hexadecimal format in CListCtrl. For ex. if i have ch[0]=0x10,it should be displayed as 10 in the list control. can anybody help?
Here is my code, but it displays l in the list control.
******************************
unsigned char DataMsg[32];
LV_ITEM lvitem;
CString dataText= (CString)DataMsg[0];
lvitem.mask = LVIF_TEXT | 0;
lvitem.iItem = iItem;
lvitem.iSubItem = 0;
pStrTemp1= dataText.GetBuffer(dataText.GetLength());
lvitem.pszText = pStrTemp1;
m_listCntrl.InsertItem(&lvitem);
***********************************
Rsh
|
|
|
|
|
You could use an ostringstream and I think the modifier is hex() to make it display as hex.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|