Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > C++ Practice
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 45045 of 48022
Post > Topic >>

C++ Practice

by "mc" <mc_roam@[EMAIL PROTECTED] > Apr 18, 2008 at 08:52 AM

Hi all,

I've a long experience with C but am just getting up to speed with C++, so

please bear with me if that's obvious.

I've got a class that parses a data file and creates a vector of AESKey, a

vector of Package, GPS data and more.  This data is not sequential in the 
file so the parsing in the file is ***bersome and out of my control 
(provided by customer).

Now, I've got another class that is build based of AESKey objects. 
Currently, the constructor is as follows:
    CryptoEngine(int numKeys, AESKey * keys);

To make it more elegant -or so I think, I'm thinking of passing a vector
of 
AESKey to make it like this:
    CryptoEngine(std::vector<AESKey>& keys);

so that the CryptoEngine "owns" this vector (it's anyways the only object 
using it).  This would be best as when the object is deleted, all the data

it needs is deleted as well.

The problem is that this vector of AESKey can be huge (100 of Mb), don't
ask 
me why, that's how our application is. :-(    So when I'd be copying the 
argument being passed to the CryptoEngine, the amount of RAM needed for
the 
argument is duplicated by the copy constructor and there's basically a 
"memcpy".   Is there a way to work this around in a C++ way?   The obvious

would be to parse the file in the CryptoEngine but it's a no-can-do as
this 
file contains data (non sequential) for mutiple types of objects.

Thank you in advance.

Best regards,


Mike
 




 3 Posts in Topic:
C++ Practice
"mc" <mc_roa  2008-04-18 08:52:48 
Re: C++ Practice
"Victor Bazarov"  2008-04-18 12:16:48 
Re: C++ Practice
"mc" <mc_roa  2008-04-18 10:13:12 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 11:42:07 CDT 2008.