#include "../include/Data.h"
#include "../../Common/include/Debug.h"

namespace environment {
namespace data {

  Entity Data::entity (uint32_t address, uint32_t size)
  {
//     _cout(DATA, "  * Data::entity\n");
//     _cout(DATA, "    * address      : %.8x\n",address);
//     _cout(DATA, "    * size         : %d\n"  ,size   );

    for (uint32_t num_seg = 0; num_seg < nb_seg; num_seg ++)
      if (segment[num_seg]->test (address,size) == true)
	return Entity (true,segment[num_seg]);
    
    return Entity (false);
  }
  
  Entity Data::entity (std::string name)
  {
    for (uint32_t num_seg = 0; num_seg < nb_seg; num_seg ++)
      if (segment[num_seg]->test(name) == true)
	return Entity (true,segment[num_seg]);
    
    return Entity (false);
  }

};
};
