function ProcessReaderData(READER $rdr, LOGGROUP $grp, $from = 0, $to = 0, $filter_data) { if (!$filter_data) { $filter_data = array(); } $data = $rdr->GetRawData($grp, $from, $to, $this, $filter_data); return $this->filter->Process($this->Process($data, $filter_data), $filter_data); }
function __construct(READER $rdr, LOGGROUP $grp, DATAFilter $filter, &$opts = NULL) { if ($rdr instanceof CACHEReader) { $this->skip = true; } else { $this->skip = false; parent::__construct($rdr->GetGroupSize($grp), $opts); } }
function __construct(READER $rdr, LOGGROUP $grp, DATAFilter $filter, &$opts = NULL) { if ($rdr instanceof CACHEReader) { $this->skip = true; } else { $this->skip = false; $this->filters = array(); foreach ($opts['extractors'] as $ext => &$items) { $config =& $opts['config'][$ext]; $filter_class = $config['filter']; ADEI::RequireClass("extractors/{$filter_class}", true); $this->filters[$ext] = array(); foreach ($items as $item => $mask) { $this->filters[$ext][$item] = new $filter_class($mask, $config); } } $this->mappings = $opts['mappings']; $mask = $filter->GetItemMask(); if ($mask && !$mask->IsFull()) { $this->check_masked = true; $this->cur_indexes = array(); $i = 0; foreach ($mask->ids as $id) { $this->cur_indexes[$id] = $i++; } } else { $this->check_masked = false; $this->cur_indexes = range(0, $rdr->GetGroupSize($grp) - 1); } if ($opts['mask'] && !$opts['mask']->IsFull()) { $this->real_indexes = array(); $i = 0; foreach ($opts['mask']->ids as $id) { $this->real_indexes[$id] = $i++; } } else { $this->real_indexes = range(0, $rdr->GetGroupSize($grp) - 1); } $this->remove = sizeof($this->cur_mask) - sizeof($this->real_mask); if ($this->remove < 0) { $this->remove = 0; } } }
function CreateMask(LOGGROUP $grp = NULL, array &$minfo = NULL, $flags = 0) { if ($this->reader_access) { $rdr = $this->req->CreateReader(); $msk = $rdr->CreateMask($grp, $minfo, $flags); unset($rdr); return $msk; } return parent::CreateMask($grp, $minfo, $flags); }
function __construct(&$props) { parent::__construct($props); $this->db = new DATABASE($this->server); $this->req_cols = "ID AS gid, full_name AS name, writable, facility, NULL as axis"; $this->data_table = "att_@gid@"; $this->data_cond = false; $this->ro_cols = array("value"); $this->rw_cols = array("read_value", "write_value"); }
function CreateCacheSet(LOGGROUP $grp = NULL, MASK $mask = NULL) { $grp = $this->CheckGroup($grp); if (!($grp->gid < 0)) { if (strcmp($grp->gid, VIRTUALReader::COMPLEX_ID) && strcmp($grp->gid, VIRTUALReader::SRCTREE_ID)) { return parent::CreateCacheSet($grp, $mask); } } if (!$mask) { $mask = $this->CreateMask($grp); } /* Old method $reqlist = $this->srctree->GetRequests($mask); */ $reqlist = $this->srctree->GetRequests($mask, array($this, "CastProps")); return $this->req->CreateCacheSet($reqlist); }
function CheckData(READER $reader, LOGGROUP $grp, INTERVAL $iv, CACHESet $caches, array &$data, array &$spec) { global $GRAPH_MAX_CACHE_GAP; if (!$spec['amount'][1] || !$data) { $grinfo = $reader->GetGroupInfo($grp, REQUEST::LIST_COMPLEX | REQUEST::LIST_VIRTUAL); $grname = $grinfo['name']; $dbname = $reader->req->GetSourceTitle(); if ($caches->IsEmpty()) { throw new ADEIException(translate("CACHESet (%s -- %s) is empty: No channels are selected", $dbname, $grname), ADEIException::NO_DATA); } else { $from = date('c', floor($iv->GetWindowStart())); $to = date('c', ceil($iv->GetWindowEnd())); throw new ADEIException(translate("CACHESet (%s -- %s) have no data available between %s and %s ", $dbname, $grname, $from, $to), ADEIException::NO_DATA); } } if ($GRAPH_MAX_CACHE_GAP) { if ($from - $iv->window_start < $GRAPH_MAX_CACHE_GAP || $to - $iv->window_start - $iv->window_size < $GRAPH_MAX_CACHE_GAP) { $range1 = date("c", ceil($iv->window_start)) . " and " . date("c", floor($iv->window_start + $iv->window_size)); $range2 = date("c", ceil($from)) . " and " . date("c", floor($to)); throw new ADEIException(translate("The data is missing in CACHE: Needed: {$range1}, Available: {$range2}")); } } }
function __construct(&$props) { parent::__construct($props); $this->items = array(array("name" => _("Line"), "func" => '$y=0', "noise" => 0.1), array("name" => _("Sinus"), "func" => '$y=sin(deg2rad($x/$period))'), array("name" => _("Cosinus"), "func" => '$y=cos(deg2rad($x/$period))')); if ($this->dbname) { $list = $this->opts->ListConfiguredGroups(); if ($list) { $this->groups = array(); foreach ($list as $gid) { $this->groups[$gid] = array(); } } else { $this->groups = array('default' => array('name' => _("Default Group"))); } } /* if (sizeof($list) > 1) { array_push($this->groups, array( 'id' => "-1", 'name' => _("Combined Group"), 'complex' => true ); } */ }
function CreateAxes($flags = 0) { if ($this->axes) { return $this->axes; } $axes_table = $this->opts->Get("axes_table"); if ($axes_table) { $this->axes = new DBAxes($this->req, $this->db, $axes_table, $flags | ($this->private_axes ? GRAPHAxes::PRIVATE_AXES : 0)); return $this->axes; } else { return parent::CreateAxes($flags); } }
function __construct(READER $rdr, LOGGROUP $grp, DATAFilter $filter, &$opts = NULL) { if ($rdr instanceof CACHEReader) { $this->skip = true; } else { $this->skip = false; $filter_class = $opts['filter']; if (!(include_once "item/" . strtolower($filter_class) . ".php")) { if (!isset($opts['filter'])) { throw new ADEIException(translate("No item filter is configured")); } else { throw new ADEIException(translate("Unsupported item filter is configured: \"%s\"", $filter_class)); } } $this->filter = new $filter_class($opts); $mask = $filter->GetItemMask(); if ($mask && !$mask->IsFull()) { $this->check_masked = true; } else { $this->check_masked = false; } if (isset($opts['item_mask'])) { $this->indexes = array(); $key = array(); $re = array(); if (is_array($opts['item_mask'])) { if (is_array($opts['item_mask'][0])) { $checks = $opts['item_mask']; } else { $checks = array($opts['item_mask']); } } else { $re = $opts['item_mask']; if ($mask) { $checks = false; $i = 0; foreach ($mask->ids as $id) { if (preg_match($re, $id)) { $this->indexes[$i] = $id; } $i++; } } else { $checks = array(array("key" => id, "items" => $re)); } } if ($checks) { $items = $rdr->GetItemList($grp, $mask ? $mask : new MASK()); $i = 0; foreach ($items as &$item) { $matched = true; foreach ($checks as $check) { if (!preg_match($check['items'], $item[$check['key']])) { $matched = false; break; } } if ($matched) { $this->indexes[$i] = $item["id"]; } $i++; } } } else { if ($mask && !$mask->IsFull()) { $this->indexes = $mask->ids; } else { $this->indexes = range(0, $rdr->GetGroupSize($grp) - 1); } } } }
function ApplyReader(READER &$reader, LOGGROUP &$grp, $flags = 0) { if ($flags & INTERVAL::NEED_AMOUNT || $this->end_mode || $this->all_mode) { if (flags & INTERVAL::NEED_AMOUNT) { $info = $reader->GetGroupInfo($grp, REQUEST::NEED_INFO | REQUEST::NEED_COUNT); $this->Apply($info['first'], $info['last'], $info['records']); } else { $info = $reader->GetGroupInfo($grp, REQUEST::NEED_INFO); $this->Apply($info['first'], $info['last']); } } else { $this->UpdateWindow(); } }
function __construct(READER $rdr, LOGGROUP $grp, DATAFilter $filter, &$opts = NULL) { if ($rdr instanceof CACHEReader && !$opts['filter_cache_reader']) { $this->skip = true; } else { $this->skip = false; if (is_array($opts)) { if ($opts["check_precise"] && !$rdr instanceof CACHEReader) { $rep = new NULLFilterAllowedMaskReporter($rdr, $grp); } else { $rep = NULL; } } parent::__construct($opts, $rep); if (!isset($opts["ignore_invalid_data"])) { $this->report_invalid_data = !$rdr->GetGroupOption($grp, "ignore_invalid_data", false); } } }
/** * class constructor * */ function __construct(&$props) { parent::__construct($props); # server parameter $server = $this->req->srv; $database = $server['database'][0]; $http_method = $server['http_method']; $host = $server['host']; $port = $server['port']; $username = $server['user']; $password = $server['password']; # options parameter $options = $this->opts; # credentials $credential = ""; if ($username && $password) { $credential = implode(":", array($username, $password)); $credential = $credential . "@"; } # ports if ($port) { $port = ":" . $port; } # build URL for queries $this->base_view_url = implode("", array($http_method . "://", $credential, $host, $port . "/", $database . "/", "_design/", "%design_view%/", "_view/")); $this->base_url = implode("", array($http_method . "://", $credential, $host, $port . "/", $database . "/")); $this->resample = $options->props['resample']; }
function GetMaskList(LOGGROUP $grp = NULL, $flags = 0) { $grp = $this->CheckGroup($grp, $flags); $list = array(); $resp = $this->db->Query("SELECT maskid, name, mask FROM masks WHERE gid=" . $grp->gid); foreach ($resp as $row) { if (!preg_match("/[\\w\\d]/", $row['name'])) { $row['name'] = _("No name"); } $id = "maskid" . $row['maskid']; $list[$id] = array('id' => $id, 'name' => $this->db->RecodeMessage($row['name'])); if ($flags & REQUEST::NEED_INFO) { $list[$id]['mask'] = implode(",", $this->ParseMask($row['mask'])); } } $timestamps = $this->req->GetGroupOption("timestamp_channels", $grp); if ($timestamps) { if ($timestamps === true) { $timestamps = 2; } $items = sizeof($this->GetItemList($grp, NULL, $flags)); if ($items > $timestamps) { for ($i = $timestamps; $i < $items; $i++) { if ($i == $timestamps) { $all = $i; } else { $all .= "," . $i; } } } $list["all"] = array('id' => "all", 'name' => _("All"), 'mask' => $all); } return array_merge(parent::GetMaskList($grp, $flags), $list); }
function CreateAxes($flags = 0) { if ($this->axes) { return $this->axes; } $axes_table = $this->req->GetGroupOptions()->options['axes_table']; if ($axes_table) { $this->axes = new MUNINAxes($this->req, $axes_table); //try to change this to GRAPHAxes and then something... return $this->axes; } else { return parent::CreateAxes($flags); } }
function ExportGroup(REQUEST $req, READER $rdr, LOGGROUP $grp, INTERVAL $ivl, MASK $msk = NULL, $title = false) { global $ROOT_COMBIHIST_LIMIT; if (!$title) { $title = $this->GetGroupName($rdr->srvid, $rdr->dbname, $grp->gid, $msk ? $msk->name : ""); } $opts =& $req->GetOptions(); $subseconds = !$opts->Get('ignore_subsecond'); if ($this->stream && !$this->handler->multigroup) { $stream_args = array_merge($this->stream_args, array("expected_blocks" => $this->expected_groups, "block_title" => $title, "block_number" => 0)); $stream_args["extension"] = $this->handler->GetExtension(); if (in_array("ROOT", $this->specials)) { if (!isset($ROOT_COMBIHIST_LIMIT) || $ivl->GetWindowSize() < $ROOT_COMBIHIST_LIMIT) { $stream_args['root__combhist'] = 1; } else { $stream_args['root__combhist'] = 0; } } $this->stream->BlockStart($stream_args); } $this->handler->GroupStart($title, $subseconds); $rdr->Export($this->handler, $grp, $msk, $ivl, $this->resample, "", $this->dmcb); $this->handler->GroupEnd(); if ($this->stream && !$this->handler->multigroup) { $this->stream->BlockEnd(); } }