@@ -197,16 +197,16 @@ GalleySetBase::extract_internal(std::shared_ptr<Blob> blob)
197197int variated_count =0 ;
198198
199199/* Loop throight stamps calculating total sizes and seeing what kind of stamps do we have*/
200- for (StampBase & s : stamps)
200+ for (std::shared_ptr< StampBase> s : stamps)
201201 {
202- fixed_total_size += s. minSize ();
203- if (s. isVariated ())
202+ fixed_total_size += s-> minSize ();
203+ if (s-> isVariated ())
204204 {
205- max_varited_total_size += s. maxSize () - s. minSize ();
205+ max_varited_total_size += s-> maxSize () - s-> minSize ();
206206 has_variated_stamps =true ;
207207 variated_count++;
208208 }
209- if (s. isUnbounded ())
209+ if (s-> isUnbounded ())
210210 {
211211 has_unbounded_stamps =true ;
212212 unbounded_count++;
@@ -254,26 +254,26 @@ GalleySetBase::extract_internal(std::shared_ptr<Blob> blob)
254254double total_unbounded_modifiers =0 ;
255255
256256 std::vector<double > size_modifiers;
257- for (StampBase & s : stamps)
257+ for (std::shared_ptr< StampBase> s : stamps)
258258 {
259259 ORACLE_TYPE o_value =0 ;
260260double modifier =0 ;
261- if (!s. isFixedSize ())
261+ if (!s-> isFixedSize ())
262262 {
263- if (s. isUnbounded () && unbounded_count <=1 )
263+ if (s-> isUnbounded () && unbounded_count <=1 )
264264 {
265265 modifier =1 ;// Nothing to predict, it will use all space
266266 }else
267267 {
268268 o_value = oracle_stamp.ExtractValue (blob);
269269 modifier = (double ) o_value / (double ) ORACLE_MAX;
270270 }
271- if (s. isUnbounded ())
271+ if (s-> isUnbounded ())
272272 {
273273 total_unbounded_modifiers += modifier;
274274 }else
275275 {
276- predicted_variated_total_size += (s. maxSize () - s. minSize ()) * modifier;
276+ predicted_variated_total_size += (s-> maxSize () - s-> minSize ()) * modifier;
277277 }
278278 }
279279 size_modifiers.push_back (modifier);
@@ -283,8 +283,8 @@ GalleySetBase::extract_internal(std::shared_ptr<Blob> blob)
283283 total_unbounded_modifiers =0 ;
284284for (int i=0 ; i<stamps.size ();i++)
285285 {
286- StampBase & s = stamps[i];
287- if (s. isUnbounded ())
286+ std::shared_ptr< StampBase> s = stamps[i];
287+ if (s-> isUnbounded ())
288288 {
289289 size_modifiers[i] =1 ;
290290 total_unbounded_modifiers +=1 ;
@@ -321,26 +321,26 @@ GalleySetBase::extract_internal(std::shared_ptr<Blob> blob)
321321/* chopping this sizes out of the blob and saving them a result vector*/
322322for (int i=0 ; i<stamps.size ();i++)
323323 {
324- StampBase & s = stamps[i];
324+ std::shared_ptr< StampBase> s = stamps[i];
325325double modifier = size_modifiers[i];
326326int el_size;
327- if (s. isFixedSize ())
327+ if (s-> isFixedSize ())
328328 {
329- el_size = s. minSize ();
329+ el_size = s-> minSize ();
330330 }
331- if (s. isVariated ())
331+ if (s-> isVariated ())
332332 {
333- double len = (s. maxSize () - s. minSize ()) * modifier * k_variated + variated_remainder;
333+ double len = (s-> maxSize () - s-> minSize ()) * modifier * k_variated + variated_remainder;
334334 el_size =round (len);
335335 variated_remainder = len - el_size;
336- el_size += s. minSize ();
336+ el_size += s-> minSize ();
337337 }
338- if (s. isUnbounded ())
338+ if (s-> isUnbounded ())
339339 {
340340double len = modifier * k_unbounded + unbounded_remainder;
341341 el_size =round (len);
342342 unbounded_remainder = len - el_size;
343- el_size +=s. minSize ();
343+ el_size +=s-> minSize ();
344344 }
345345std::shared_ptr<Blob> blob2 = blob->Chop (el_size);
346346 res.push_back (blob2);
@@ -355,8 +355,8 @@ GalleySetBase::LoadAll(std::shared_ptr<Blob> blob)
355355for (int i=0 ; i<blobs.size (); i++)
356356 {
357357std::shared_ptr<Blob> blob = blobs[i];
358- StampBase & stamp = stamps[i];
359- stamp. Load (blob);
358+ std::shared_ptr< StampBase> s = stamps[i];
359+ s-> Load (blob);
360360 }
361361}
362362
@@ -369,8 +369,8 @@ GalleySetStr::ExtractStrSet(std::shared_ptr<Blob> blob)
369369for (int i=0 ; i<blobs.size (); i++)
370370 {
371371std::shared_ptr<Blob> blob = blobs[i];
372- StampBaseStr & stamp =s_stamps [i];
373- std::string str = stamp. ExtractStr (blob);
372+ auto stamp =std::dynamic_pointer_cast<StampBaseStr>(stamps [i]) ;
373+ std::string str = stamp-> ExtractStr (blob);
374374 res.push_back (str);
375375 }
376376return res;
@@ -384,8 +384,8 @@ GalleySetBin::ExtractBinSet(std::shared_ptr<Blob> blob)
384384for (int i=0 ; i<blobs.size (); i++)
385385 {
386386std::shared_ptr<Blob> blob = blobs[i];
387- StampBaseBin & stamp =b_stamps [i];
388- std::vector<char > v = stamp. ExtractBin (blob);
387+ auto stamp =std::dynamic_pointer_cast<StampBaseBin>(stamps [i]) ;
388+ std::vector<char > v = stamp-> ExtractBin (blob);
389389 res.push_back (v);
390390 }
391391return res;
@@ -403,15 +403,15 @@ GalleySetBase::minSize()
403403int res =0 ;
404404
405405/* Loop throight stamps calculating total sizes and seeing what kind of stamps do we have*/
406- for (StampBase & s : stamps)
406+ for (std::shared_ptr< StampBase> s : stamps)
407407 {
408- res += s. minSize ();
409- if (s. isVariated ())
408+ res += s-> minSize ();
409+ if (s-> isVariated ())
410410 {
411411 has_variated_stamps =true ;
412412 variated_count++;
413413 }
414- if (s. isUnbounded ())
414+ if (s-> isUnbounded ())
415415 {
416416 has_unbounded_stamps =true ;
417417 unbounded_count++;
@@ -434,14 +434,14 @@ GalleySetBase::maxSize()
434434int res =0 ;
435435
436436/* Loop throight stamps calculating total sizes and seeing what kind of stamps do we have*/
437- for (StampBase & s : stamps)
437+ for (std::shared_ptr< StampBase> s : stamps)
438438 {
439- res += s. maxSize ();
440- if (s. isVariated ())
439+ res += s-> maxSize ();
440+ if (s-> isVariated ())
441441 {
442442 res += ORACLE_SIZE;// Each variated stamp needs an oracle to predict it's size. It also affects max size
443443 }
444- if (s. isUnbounded ())
444+ if (s-> isUnbounded ())
445445 {
446446return -1 ;// Junst one unbounded stamp makes all thing unbounded
447447 }