Przeglądaj źródła

tidy namespace saccades

master
Pete McNeil 4 lat temu
rodzic
commit
5b5652e983
2 zmienionych plików z 11 dodań i 18 usunięć
  1. 5
    7
      snf_saccades.cpp
  2. 6
    11
      snf_saccades.hpp

+ 5
- 7
snf_saccades.cpp Wyświetl plik

@@ -7,19 +7,17 @@
#include <vector>
#include "snf_saccades.hpp"
using namespace std;
bool doesOverlap(unsigned int workingStart, unsigned int testStart, unsigned int workingFinish) {
return(
testStart >= workingStart &&
testStart <= workingFinish
);
}
vector<saccade> saccades_engine::recall() {
vector<saccade> recollection;
std::vector<saccade> saccades_engine::recall() {
std::vector<saccade> recollection;
int markersSize = markers.size();
if(0 < markersSize) {
set<saccade_marker>::iterator i;
std::set<saccade_marker>::iterator i;
recollection.reserve(markers.size());
bool isFirstPass = true;
unsigned int workingStart = 0;
@@ -100,7 +98,7 @@ void saccades_engine::recycleEngram(saccade s) {
void saccades_engine::evoke(saccade s) {
bool stillGrowing = (capacity > engrams.size());
set<saccade_marker>::iterator i;
std::set<saccade_marker>::iterator i;
saccade_marker testMarker(s,0);
i = markers.find(testMarker);
bool isRemembered = (i != markers.end());
@@ -118,7 +116,7 @@ void saccades_engine::evoke(saccade s) {
}
}
void saccades_engine::learn(vector<saccade>& experiences) {
void saccades_engine::learn(std::vector<saccade>& experiences) {
for(unsigned int i = 0; i < experiences.size(); i++) {
evoke(experiences[i]);
}

+ 6
- 11
snf_saccades.hpp Wyświetl plik

@@ -1,16 +1,13 @@
// snf_saccades.hpp
// Saccades engine adaptation for MessageSniffer
// Copyright 2014 MicroNeil Research Corporation (www.microneil.com)
// Copyright 2014-2020 MicroNeil Research Corporation (www.microneil.com)
// Licensed to ARM Research Labs for use in Message Sniffer.
#ifndef _MN_SACCADES_ENGINE
#define _MN_SACCADES_ENGINE
#pragma once
#include <set>
#include <vector>
using namespace std;
class saccades_engine;
class saccade {
friend class saccades_engine;
@@ -91,8 +88,8 @@ struct saccade_engram {
class saccades_engine {
private:
vector<saccade_engram> engrams;
set<saccade_marker> markers;
std::vector<saccade_engram> engrams;
std::set<saccade_marker> markers;
const unsigned int capacity;
int mostFresh;
@@ -115,9 +112,7 @@ class saccades_engine {
engrams.reserve(capacity);
}
vector<saccade> recall();
void learn(vector<saccade>& experiences);
std::vector<saccade> recall();
void learn(std::vector<saccade>& experiences);
};
#endif

Ładowanie…
Anuluj
Zapisz