#include <fstream>  // NOLINT(readability/streams)
#include <iostream>  // NOLINT(readability/streams)
#include <string>
#include <utility>
#include <vector>

#include "caffe/data_layers.hpp"
#include "caffe/layer.hpp"
#include "caffe/util/io.hpp"
#include "caffe/util/math_functions.hpp"
#include "caffe/util/rng.hpp"

namespace caffe {

template <typename Dtype>
ImagePairDataLayer<Dtype>::~ImagePairDataLayer<Dtype>() {
	;
}

template <typename Dtype>
void ImagePairDataLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
      vector<Blob<Dtype>*>* top) {
}

template <typename Dtype>
void ImagePairDataLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
      vector<Blob<Dtype>*>* top) {
}

template <typename Dtype>
void ImagePairDataLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
      vector<Blob<Dtype>*>* top) {
	file2class.clear();
	file2id.clear();
	std::ifstream img_files_if(this->layer_param_.image_data_pair_param().img_files().c_str());
	string filename;
	int label;
	int sid;
	while(img_files_if >> filename >> label >> sid) {
		std::map<std::string, int>::iterator iter = file2class.find(filename);
		std::map<int, int>::iterator iter1 = class2num.find(label);
		if (iter1 == class2num.end()) {
			class2num.insert(iter1,std::make_pair(label,1));
			file2id.insert(iter,std::make_pair(filename, 1));
		} else {
			iter1->second++;
			file2id.insert(iter,std::make_pair(filename, iter1->second));
		}
		file2class.insert(iter,std::make_pair(filename, label));
	}
	img_files_if.close();
	if (Caffe::phase()==Caffe::TRAIN) {
		;
	} else {
		;
	}
}

template <typename Dtype>
void ImagePairDataLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
      const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom) {
;
}

template <typename Dtype>
void ImagePairDataLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom,
      vector<Blob<Dtype>*>* top) {
;
}

template <typename Dtype>
void ImagePairDataLayer<Dtype>::Backward_gpu(const vector<Blob<Dtype>*>& top,
      const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom) {
;
}
INSTANTIATE_CLASS(ImagePairDataLayer);

}  // namespace caffe
