summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Wuerthwein <fkw@ucsd.edu>2009-02-12 00:07:17 +0000
committerFrank Wuerthwein <fkw@ucsd.edu>2009-02-12 00:07:17 +0000
commit52f61c9c992215cc14ef2b81f009d225979c3d66 (patch)
treebd1d445bc0e433a0285079e8bfc058df52327124 /src
parent095d686cabad40b847a608d1c8dd73ef6fd96e96 (diff)
getDSbyName now returns a RRDDS object. RRDDS, RRDRRAInfo and RRDRRA now have a getIdx method.
Diffstat (limited to 'src')
-rw-r--r--src/lib/rrdFile.js24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/lib/rrdFile.js b/src/lib/rrdFile.js
index aee1112..b8ed7a0 100644
--- a/src/lib/rrdFile.js
+++ b/src/lib/rrdFile.js
@@ -62,11 +62,15 @@ InvalidRRD.prototype.toString = function() {
// ============================================================
// RRD DS Info class
-function RRDDS(rrd_data,rrd_data_idx) {
+ function RRDDS(rrd_data,rrd_data_idx,my_idx) {
this.rrd_data=rrd_data;
this.rrd_data_idx=rrd_data_idx;
+ this.my_idx=my_idx;
}
+RRDDS.prototype.getIdx = function() {
+ return this.my_idx;
+}
RRDDS.prototype.getName = function() {
return this.rrd_data.getCStringAt(this.rrd_data_idx,20);
}
@@ -84,12 +88,17 @@ RRDDS.prototype.getMax = function() {
// ============================================================
// RRD RRA Info class
function RRDRRAInfo(rrd_data,rra_def_idx,
- rrd_align,row_cnt,pdp_step) {
+ rrd_align,row_cnt,pdp_step,my_idx) {
this.rrd_data=rrd_data;
this.rra_def_idx=rra_def_idx;
this.rrd_align=rrd_align;
this.row_cnt=row_cnt;
this.pdp_step=pdp_step;
+ this.my_idx=my_idx;
+}
+
+RRDRRAInfo.prototype.getIdx = function() {
+ return this.my_idx;
}
// Get number of rows
@@ -152,6 +161,10 @@ function RRDRRA(rrd_data,rra_ptr_idx,
}
}
+RRDRRA.prototype.getIdx = function() {
+ return this.rra_info.getIdx();
+}
+
// Get number of rows/columns
RRDRRA.prototype.getNrRows = function() {
return this.row_cnt;
@@ -299,7 +312,7 @@ RRDHeader.prototype.getNrDSs = function() {
}
RRDHeader.prototype.getDS = function(idx) {
if ((idx>=0) && (idx<this.ds_cnt)) {
- return new RRDDS(this.rrd_data,this.ds_def_idx+this.ds_el_size*idx);
+ return new RRDDS(this.rrd_data,this.ds_def_idx+this.ds_el_size*idx,idx);
} else {
throw RangeError("DS idx ("+ idx +") out of range [0-" + this.ds_cnt +").");
}
@@ -309,7 +322,7 @@ RRDHeader.prototype.getDSbyName = function(name) {
var ds=this.getDS(idx);
var ds_name=ds.getName()
if (ds_name==name)
- return idx;
+ return ds;
}
return undefined;
}
@@ -321,7 +334,8 @@ RRDHeader.prototype.getRRAInfo = function(idx) {
if ((idx>=0) && (idx<this.rra_cnt)) {
return new RRDRRAInfo(this.rrd_data,
this.rra_def_idx+idx*this.rra_def_el_size,
- this.rrd_align,this.rra_def_row_cnts[idx],this.pdp_step);
+ this.rrd_align,this.rra_def_row_cnts[idx],this.pdp_step,
+ idx);
} else {
throw RangeError("RRA idx ("+ idx +") out of range [0-" + this.rra_cnt +").");
}